Skip to content

Commit

Permalink
Fix release workflow (#3689)
Browse files Browse the repository at this point in the history
### What

- Remove usage of `create-pull-request` action, we'll create the PR
ourselves from now on
- Add `commit` step which commits the version bump if needed

Closes #3776:

- rerun-io redeploy failed (missing `actions/checkout`)
- web publish fails due to no GCS auth
- RRD file not published by web publish
- make sure all web_viewer builds on CI are ordered debug -> release
- fix post-release version bump, should also work for alpha
- fix final release version not being updated
- create PRs using gh CLI instead of `create-pull-request` action

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3689) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3689)
- [Docs
preview](https://rerun.io/preview/22f1695d0a5a3eb782a4ca89069b8b827338a140/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/22f1695d0a5a3eb782a4ca89069b8b827338a140/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
  • Loading branch information
jprochazk authored Oct 12, 2023
1 parent 2cada94 commit d474d82
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 23 deletions.
103 changes: 88 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,38 @@ jobs:
git push
echo "version_bump_commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Create pull request
env:
GH_TOKEN: ${{ secrets.RERUN_BOT_TOKEN }}
run: |
pr=$(gh pr view --json headRefName 2>/dev/null)
if echo "$pr" | jq '. | has("headRefName")' | grep -q 'true'; then
echo "PR already exists"
exit 0
fi
echo "PR does not exist, creating…"
cat <<EOF > pr-body.txt
# Release ${{ steps.versioning.outputs.final }}
### Next steps
- [Test the release](#testing)
- If this is an `alpha` release, you can just merge the pull request.
- Otherwise:
- For any added commits, run the release workflow in `rc` mode again
- After testing, run the release workflow in `release` mode
- Once the final release workflow finishes, [create a GitHub release](https://github.com/rerun-io/rerun/releases/new)
EOF
gh pr create \
--base main \
--head $(git branch --show-current) \
--label "⛴ release" \
--label "exclude from changelog" \
--fill \
--body-file pr-body.txt
update-docs:
name: "Update Docs"
needs: [version]
Expand Down Expand Up @@ -175,7 +207,36 @@ jobs:
git checkout ${{ github.ref_name }}
git push --force origin ${{ github.ref_name }}:latest
post-release-version-bump:
alpha-version-bump:
name: "Alpha Version Bump"
if: inputs.release-type == 'alpha'
needs: [version, update-docs, publish-crates, build-and-publish-wheels, build-and-publish-web]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.RERUN_BOT_TOKEN }}

- name: Install dependencies
run: |
python3 -m pip install -r scripts/ci/requirements.txt
# After an alpha release, we bump the prerelease version and append `+dev`.
- name: Update version
id: update-version
run: |
python3 scripts/ci/crates.py version --bump prerelease --dev
echo "version=$(python3 scripts/ci/crates.py get-version)" >> "$GITHUB_OUTPUT"
- name: Commit new version
run: |
git config --global user.name "rerun-bot"
git config --global user.email "bot@rerun.io"
git commit -am "Bump versions to ${{ steps.update-version.outputs.version }}"
git push
final-version-bump:
name: "Post-release Version Bump"
if: inputs.release-type == 'final'
needs: [version, update-docs, publish-crates, build-and-publish-wheels, build-and-publish-web]
Expand All @@ -185,6 +246,7 @@ jobs:
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.RERUN_BOT_TOKEN }}

- name: Install dependencies
run: |
Expand All @@ -197,19 +259,30 @@ jobs:
python3 scripts/ci/crates.py version --bump minor --dev
echo "version=$(python3 scripts/ci/crates.py get-version)" >> "$GITHUB_OUTPUT"
- name: Commit new version
id: commit-version
run: |
branch_name="bump-${{ steps.update-version.outputs.version }}"
git checkout -b $branch_name
git commit -am "Bump versions to ${{ steps.update-version.outputs.version }}"
git push -u origin $branch_name
echo "branch=$branch_name" >> "$GITHUB_OUTPUT"
- name: Create pull request
uses: peter-evans/create-pull-request@v5.0.2
with:
token: ${{ secrets.RERUN_BOT_TOKEN }}
base: main
branch: "post-${{ github.ref_name }}"
commit-message: "bump versions to ${{ steps.update-version.outputs.version }}"
title: "Post-release ${{ needs.version.outputs.final }}"
labels: "⛴ release"
committer: "Rerun Bot <bot@rerun.io>"
author: "Rerun Bot <bot@rerun.io>"
body: |
### What
- [x] Bump all crate versions to `${{ steps.update-version.outputs.version }}`
env:
GH_TOKEN: ${{ secrets.RERUN_BOT_TOKEN }}
run: |
cat <<EOF > pr-body.txt
### What
- [x] Bump all crate versions to `${{ steps.update-version.outputs.version }}`
EOF
gh pr create \
--base main \
--head ${{ steps.commit-version.outputs.branch }} \
--label "⛴ release" \
--label "exclude from changelog" \
--fill \
--body-file pr-body.txt
23 changes: 16 additions & 7 deletions .github/workflows/reusable_build_and_publish_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ on:
type: boolean
required: true

permissions:
contents: "write"
id-token: "write"

jobs:
get-commit-sha:
name: Get Commit Sha
Expand All @@ -51,6 +55,12 @@ jobs:
with:
ref: ${{ inputs.release-commit }}

- id: "auth"
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}

- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
Expand Down Expand Up @@ -98,18 +108,12 @@ jobs:
shell: bash
run: ./scripts/setup_web.sh

- name: Build app.rerun.io (release)
- name: Build app.rerun.io
uses: actions-rs/cargo@v1
with:
command: run
args: --locked -p re_build_web_viewer -- --release

- name: Build app.rerun.io (debug)
uses: actions-rs/cargo@v1
with:
command: run
args: --locked -p re_build_web_viewer -- --debug

- name: Build web demo
env:
COMMIT_HASH: ${{ needs.get-commit-sha.outputs.short-sha }}
Expand Down Expand Up @@ -137,6 +141,11 @@ jobs:
destination: "rerun-demo/version/${{ inputs.release-version }}"
parent: false

- name: Publish app.rerun.io
if: inputs.update-latest
run: |
gsutil -m cp -r 'gs://rerun-example-rrd/version/${{ inputs.release-version }}/*' gs://rerun-example-rrd/version/latest
- name: Publish app.rerun.io
if: inputs.update-latest
run: |
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/reusable_deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ jobs:
runs-on: ubuntu-latest
if: inputs.UPDATE_LATEST
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.RELEASE_COMMIT || (github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.sha) }}

- name: Setup Node
uses: actions/setup-node@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/crates.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def is_already_published(version: str, crate: Crate) -> bool:
body = resp.json()

# the request failed
if resp.ok:
if not resp.ok:
raise Exception(f"failed to get crate {name}: {body['errors'][0]['detail']}")

# crate has not been uploaded yet
Expand Down

0 comments on commit d474d82

Please sign in to comment.