From ebb17a7db29097a4589920ee18788a9e61a20b57 Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Mon, 22 Apr 2024 11:09:44 -0700 Subject: [PATCH] ci updates --- .github/workflows/release.yml | 18 ++++++++++++++++-- .github/workflows/reusable-proto-deploy.yml | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/reusable-proto-deploy.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d30720ae2..4ab4664859 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,13 +14,21 @@ jobs: runs-on: ubuntu-latest environment: BUF needs: run_checker - if: needs.run_checker.outputs.run_release_proto == 'true' && github.repository_owner == 'astriaorg' + if: github.event_name != 'merge_group' && needs.run_checker.outputs.run_release_proto == 'true' && github.repository_owner == 'astriaorg' steps: - uses: actions/checkout@v4 - uses: bufbuild/buf-setup-action@v1 with: version: "1.15.1" github_token: ${{ github.token }} + - name: "Get Buf Branch Annotation" + if: github.event_name == 'pull_request' + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + echo "buf_repo_ending='pr/${{ github.event.number }}'" >> $GITHUB_ENV + else + echo "buf_repo_ending='main'" >> $GITHUB_ENV + fi - name: "Upload Composer API Protos" uses: bufbuild/buf-push-action@v1 with: @@ -36,6 +44,8 @@ jobs: - name: "Update Sequencer Block API dependency" run: | cd proto/sequencerblockapis + BUF_COMMIT=$(buf beta registry commit get buf.build/astria/primitives:${{ env.buf_repo_ending }} -- format=json | jq -r '.commit') + sed -i "s/buf.build\/astria\/primitives/buf.build\/astria\/primitives:$BUF_COMMIT/" buf.yaml buf mod update --only buf.build/astria/primitives - name: "Upload Sequencer Block API Protos" uses: bufbuild/buf-push-action@v1 @@ -46,6 +56,8 @@ jobs: - name: "Update Execution API dependency" run: | cd proto/executionapis + BUF_COMMIT=$(buf beta registry commit get buf.build/astria/sequencerblock-apis:${{ env.buf_repo_ending }} -- format=json | jq -r '.commit') + sed -i "s/buf.build\/astria\/primitives/buf.build\/astria\/sequencerblock-apis:$BUF_COMMIT/" buf.yaml buf mod update --only buf.build/astria/sequencerblock-apis - name: "Upload Execution API Protos" uses: bufbuild/buf-push-action@v1 @@ -56,6 +68,8 @@ jobs: - name: "Update Protocol API dependency" run: | cd proto/protocolapis + BUF_COMMIT=$(buf beta registry commit get buf.build/astria/primitives:${{ env.buf_repo_ending }} -- format=json | jq -r '.commit') + sed -i "s/buf.build\/astria\/primitives/buf.build\/astria\/primitives:$BUF_COMMIT/" buf.yaml buf mod update --only buf.build/astria/primitives - name: "Upload Protocol API Protos" uses: bufbuild/buf-push-action@v1 @@ -69,7 +83,7 @@ jobs: contents: write runs-on: ubuntu-latest needs: run_checker - if: needs.run_checker.outputs.run_release_charts == 'true' + if: github.ref_name == 'main' && needs.run_checker.outputs.run_release_charts == 'true' steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/reusable-proto-deploy.yml b/.github/workflows/reusable-proto-deploy.yml new file mode 100644 index 0000000000..98ed8322b9 --- /dev/null +++ b/.github/workflows/reusable-proto-deploy.yml @@ -0,0 +1,19 @@ +name: Reusable Proto Deploy Workflow + +on: + workflow_call: + inputs: + proto-directory: + required: true + type: string + updateable-deps: + description: 'csv of local dependencies which may need to be updated' + required: false + type: string + secrets: + BUF_TOKEN: + required: true + +jobs: + deploy: + runs-on: ubuntu-latest