Skip to content

Commit

Permalink
Add deploy proxy workflow (#427)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
MasterPtato committed Feb 1, 2024
1 parent a514a62 commit 45f75a5
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 25 deletions.
16 changes: 5 additions & 11 deletions .github/actions/pre-init/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Pre-Init"
description: "Set up Nix and Bolt"
name: pre-init
description: Set up Nix and Bolt

# TODO: Composite actions don't support defaults
# defaults:
Expand Down Expand Up @@ -58,14 +58,15 @@ runs:
shell: bash -e {0}
run: nix-shell --pure --run "echo 'Built shell'"

# MARK: Bolt
- name: Write Configs
shell: bash -e {0}
run: |
cat <<'EOF' > Bolt.local.toml
cat << 'EOF' > Bolt.local.toml
namespace = "ci"
EOF
cat <<'EOF' > namespaces/ci.toml
cat << 'EOF' > namespaces/ci.toml
[rivet]
test = {}
Expand All @@ -75,13 +76,6 @@ runs:
public_ip = "127.0.0.1"
EOF
# Write secrets so they're not prompted in `bolt init`
cat <<'EOF' > secrets/ci.toml
[sendgrid]
key = "TODO"
EOF
# MARK: Bolt
# Delete old Bolt binaries in order to fall back to the Nix-built binary
- name: Remove Old Bolt Builds
shell: bash -e {0}
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/deploy-proxy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Based on https://github.com/orgs/community/discussions/26323#discussioncomment-6749966

name: deploy-proxy

on:
pull_request:
branches:
- main
types:
- closed

defaults:
run:
# Enable fail-fast behavior
shell: bash -e {0}

jobs:
emit:
runs-on: ubuntu-latest
# Only trigger on successful merge
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- uses: actions/github-script@v6
with:
# Use "Fine-grained tokens (beta)", select the target repo, give read-write access to "Content" category.
github-token: ${{ secrets.DEPLOY_PROXY_PAT }}
script: |
const result = await github.rest.repos.createDispatchEvent({
owner: 'rivet-gg',
repo: 'rivet-ee',
event_type: 'deploy_proxy',
client_payload: { }
});
console.log(result);
6 changes: 3 additions & 3 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ concurrency:
defaults:
run:
# Enable fail-fast behavior
shell: bash
shell: bash -e {0}

jobs:
cargo-deny:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: cargo deny (svc)
uses: EmbarkStudios/cargo-deny-action@v1
with:
arguments: --manifest-path svc/Cargo.toml
- name: cargy deny (lib/bolt)
- name: cargo deny (lib/bolt)
uses: EmbarkStudios/cargo-deny-action@v1
with:
arguments: --manifest-path lib/bolt/Cargo.toml
5 changes: 4 additions & 1 deletion lib/api-helper/build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ rivet-pools = { path = "../../pools" }
rivet-runtime = { path = "../../runtime" }
rivet-util = { path = "../../util/core" }
serde = { version = "1.0", features = ["derive"] }
serde_array_query = { git = "https://github.com/rivet-gg/serde_array_query.git", rev = "b9f8bfad77aea6f01dccc6cb77146b8c5daecaa3" }
serde_json = "1.0"
thiserror = "1.0"
tokio = { version = "1.29" }
Expand All @@ -48,6 +47,10 @@ types = { path = "../../types/core" }
url = "2.2.2"
uuid = { version = "1", features = ["v4"] }

[dependencies.serde_array_query]
git = "https://github.com/rivet-gg/serde_array_query.git"
rev = "b9f8bfad77aea6f01dccc6cb77146b8c5daecaa3" # pragma: allowlist secret

[dev-dependencies]
chirp-worker = { path = "../../chirp/worker" }
reqwest = { version = "0.11", features = ["json"] }
10 changes: 0 additions & 10 deletions lib/bolt/core/src/tasks/config/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,6 @@ pub async fn generate(project_path: &Path, ns_id: &str) -> Result<()> {
};
}

// MARK: SendGrid
if generator.ns.get("email").is_none() {
generator.ns["email"] = {
let mut x = toml_edit::Table::new();
x.set_implicit(true);
x["sendgrid"] = toml_edit::table();
toml_edit::Item::Table(x)
};
}

// TODO: Prompt login
if generator
.ns
Expand Down
1 change: 1 addition & 0 deletions svc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This is generated by Bolt. Do not modify.

[workspace]
resolver = "2"
members = [
"api/admin",
"api/auth",
Expand Down

0 comments on commit 45f75a5

Please sign in to comment.