From c6f783a0a3e8a456ea078fdec60253c23c72f050 Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Thu, 21 Sep 2023 16:14:48 -0700 Subject: [PATCH] Joroshiba/release take 2 (#421) ## Summary Revert of revert + fix for release changes ## Background Previously pushed changes to update release flows, it didn't work, and the nature of tests was such that rollback and redeploy with fix is best option. ## Changes - Everything from astriaorg/astria#413 + fix around base ref not existing --- .github/workflows/release.yml | 35 ++++++++++++- .github/workflows/reusable-cargo-version.yml | 53 ++++++++++++++++++++ .github/workflows/reusable-run-checker.yml | 3 ++ Cargo.lock | 8 +-- crates/astria-composer/Cargo.toml | 2 +- crates/astria-conductor/Cargo.toml | 2 +- crates/astria-sequencer-relayer/Cargo.toml | 2 +- crates/astria-sequencer/Cargo.toml | 2 +- 8 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/reusable-cargo-version.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 755e6958f..0b9f90140 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,40 @@ jobs: input: "crates/astria-proto/proto" buf_token: ${{ secrets.BUF_TOKEN }} + conductor: + needs: run_checker + if: needs.run_checker.outputs.run_release_services == 'true' + uses: ./.github/workflows/reusable-cargo-version.yml + with: + package-name: 'conductor' + display-name: 'Conductor' + + composer: + needs: run_checker + if: needs.run_checker.outputs.run_release_services == 'true' + uses: ./.github/workflows/reusable-cargo-version.yml + with: + package-name: 'composer' + display-name: 'Composer' + + sequencer: + needs: run_checker + if: needs.run_checker.outputs.run_release_services == 'true' + uses: ./.github/workflows/reusable-cargo-version.yml + with: + package-name: 'sequencer' + display-name: 'Sequencer' + + sequencer-relayer: + needs: run_checker + if: needs.run_checker.outputs.run_release_services == 'true' + uses: ./.github/workflows/reusable-cargo-version.yml + with: + package-name: 'sequencer-relayer' + display-name: 'Sequencer Relayer' + + release: - needs: [proto] + needs: [proto, conductor, composer, sequencer, sequencer-relayer] if: ${{ always() && !cancelled() }} uses: ./.github/workflows/reusable-success.yml diff --git a/.github/workflows/reusable-cargo-version.yml b/.github/workflows/reusable-cargo-version.yml new file mode 100644 index 000000000..42a5a2013 --- /dev/null +++ b/.github/workflows/reusable-cargo-version.yml @@ -0,0 +1,53 @@ +name: Reusable Cargo Version Check + +on: + workflow_call: + inputs: + package-name: + required: true + type: string + display-name: + required: true + type: string + +jobs: + rust-version-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: git fetch --all --tags + - name: Check Release Version + id: release_version + uses: thebongy/version-check@v1 + with: + file: ${{ format('crates/astria-{0}/Cargo.toml', inputs.package-name) }} + tagFormat: ${{ format('v${{version}}--{0}', inputs.package-name) }} + # Notice appears when the version has changed on a PR to main + - name: Release Notice + if: | + steps.release_version.outputs.versionChanged && + github.event_name == 'pull_request' && + github.base_ref == 'main' + run: | + FILE="${{ format('crates/astria-{0}/Cargo.toml', inputs.package-name) }}" + TITLE="New ${{ inputs.display-name}} Release" + MESSAGE=("This PR updates the version of ${{ inputs.package-name }}." + "After merging a new release ${{steps.release_version.outputs.rawVersion}}" + "will be created with tag ${{ steps.release_version.outputs.releaseVersion }}." + ) + echo "::warning file=$FILE,title=$TITLE::${MESSAGE[*]}" + # Actually release when version has changed on a push to main + - name: Release + if: | + steps.release_version.outputs.versionChanged == 'true' && + github.event_name == 'push' && + github.ref == 'refs/heads/main' + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.release_version.outputs.releaseVersion }} + release_name: ${{ inputs.display-name }} ${{ steps.release_version.outputs.rawVersion }} + draft: true + prerelease: true + diff --git a/.github/workflows/reusable-run-checker.yml b/.github/workflows/reusable-run-checker.yml index f15d0b806..ed6c32a81 100644 --- a/.github/workflows/reusable-run-checker.yml +++ b/.github/workflows/reusable-run-checker.yml @@ -24,6 +24,9 @@ on: run_release_proto: description: If release for protos needs to be run, will be 'true' value: ${{ jobs.changes.outputs.release_workflow == 'true' || jobs.changes.outputs.proto == 'true' }} + run_release_services: + description: If release for services needs to be run, will be 'true' + value: ${{ jobs.changes.outputs.release_workflow == 'true' || jobs.changes.outputs.crates == 'true' }} jobs: changes: diff --git a/Cargo.lock b/Cargo.lock index d34ed5b5a..0272f1857 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,7 +190,7 @@ dependencies = [ [[package]] name = "astria-composer" -version = "0.1.0" +version = "0.2.0" dependencies = [ "astria-proto", "astria-sequencer-client", @@ -226,7 +226,7 @@ dependencies = [ [[package]] name = "astria-conductor" -version = "0.4.0" +version = "0.5.0" dependencies = [ "astria-proto", "astria-sequencer-client", @@ -276,7 +276,7 @@ dependencies = [ [[package]] name = "astria-sequencer" -version = "0.2.0" +version = "0.4.0" dependencies = [ "anyhow", "astria-proto", @@ -333,7 +333,7 @@ dependencies = [ [[package]] name = "astria-sequencer-relayer" -version = "0.4.0" +version = "0.5.0" dependencies = [ "astria-celestia-jsonrpc-client", "astria-proto", diff --git a/crates/astria-composer/Cargo.toml b/crates/astria-composer/Cargo.toml index ce0647465..53ef4b157 100644 --- a/crates/astria-composer/Cargo.toml +++ b/crates/astria-composer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astria-composer" -version = "0.1.0" +version = "0.2.0" edition = "2021" rust-version = "1.70.0" diff --git a/crates/astria-conductor/Cargo.toml b/crates/astria-conductor/Cargo.toml index d42dca690..4ed435dab 100644 --- a/crates/astria-conductor/Cargo.toml +++ b/crates/astria-conductor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astria-conductor" -version = "0.4.0" +version = "0.5.0" edition = "2021" rust-version = "1.70.0" diff --git a/crates/astria-sequencer-relayer/Cargo.toml b/crates/astria-sequencer-relayer/Cargo.toml index b204d85dd..e45840916 100644 --- a/crates/astria-sequencer-relayer/Cargo.toml +++ b/crates/astria-sequencer-relayer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astria-sequencer-relayer" -version = "0.4.0" +version = "0.5.0" edition = "2021" license = "MIT OR Apache-2.0" rust-version = "1.70" diff --git a/crates/astria-sequencer/Cargo.toml b/crates/astria-sequencer/Cargo.toml index ca2e733a5..fae2acf41 100644 --- a/crates/astria-sequencer/Cargo.toml +++ b/crates/astria-sequencer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astria-sequencer" -version = "0.2.0" +version = "0.4.0" edition = "2021" rust-version = "1.70.0"