From d473c61d8fda64c836a79ab488c82e670caa7e5e Mon Sep 17 00:00:00 2001 From: MasterPtato Date: Thu, 1 Feb 2024 18:48:08 +0000 Subject: [PATCH] Add deploy proxy workflow --- .github/actions/pre-init/action.yaml | 16 ++++------ .github/workflows/deploy-proxy.yaml | 34 ++++++++++++++++++++++ .github/workflows/rust.yaml | 6 ++-- lib/api-helper/build/Cargo.toml | 1 + lib/bolt/core/src/tasks/config/generate.rs | 10 ------- svc/Cargo.toml | 1 + 6 files changed, 44 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/deploy-proxy.yaml diff --git a/.github/actions/pre-init/action.yaml b/.github/actions/pre-init/action.yaml index 94de51c81..def8c6143 100644 --- a/.github/actions/pre-init/action.yaml +++ b/.github/actions/pre-init/action.yaml @@ -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: @@ -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 = {} @@ -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} diff --git a/.github/workflows/deploy-proxy.yaml b/.github/workflows/deploy-proxy.yaml new file mode 100644 index 000000000..c534d4e16 --- /dev/null +++ b/.github/workflows/deploy-proxy.yaml @@ -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); diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index a5564a85b..eb57b1897 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -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 diff --git a/lib/api-helper/build/Cargo.toml b/lib/api-helper/build/Cargo.toml index 5d1400a27..ccf8ae3ea 100644 --- a/lib/api-helper/build/Cargo.toml +++ b/lib/api-helper/build/Cargo.toml @@ -34,6 +34,7 @@ rivet-pools = { path = "../../pools" } rivet-runtime = { path = "../../runtime" } rivet-util = { path = "../../util/core" } serde = { version = "1.0", features = ["derive"] } +# pragma: allowlist secret serde_array_query = { git = "https://github.com/rivet-gg/serde_array_query.git", rev = "b9f8bfad77aea6f01dccc6cb77146b8c5daecaa3" } serde_json = "1.0" thiserror = "1.0" diff --git a/lib/bolt/core/src/tasks/config/generate.rs b/lib/bolt/core/src/tasks/config/generate.rs index a3cfcedae..fe911621e 100644 --- a/lib/bolt/core/src/tasks/config/generate.rs +++ b/lib/bolt/core/src/tasks/config/generate.rs @@ -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 diff --git a/svc/Cargo.toml b/svc/Cargo.toml index 7023e2bc8..727ebc0b8 100644 --- a/svc/Cargo.toml +++ b/svc/Cargo.toml @@ -1,6 +1,7 @@ # This is generated by Bolt. Do not modify. [workspace] +resolver = "2" members = [ "api/admin", "api/auth",