Skip to content

Commit debd984

Browse files
infmagic2047ItsDoot
authored andcommitted
Fix release workflow (bevyengine#4903)
# Objective While playing with the code, I found some problems in the recently merged version-bumping workflow: - Most importantly, now that we are using `0.8.0-dev` in development, the workflow will try to bump it to `0.9.0` 😭 - The crate filter is outdated now that we have more crates in `tools`. - We are using `bevy@users.noreply.github.com`, but according to [Github help](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address#about-commit-email-addresses), that email address means "old no-reply email format for the user `bevy`". It is currently not associated with any account, but I feel this is still not appropriate here. ## Solution - Create a new workflow, `Post-release version bump`, that should be run after a release and bumps version from `0.X.0` to `0.X+1.0-dev`. Unfortunately, cargo-release doesn't have a builtin way to do this, so we need to parse and increment the version manually. - Add the new crates in `tools` to exclusion list. Also removes the dependency version specifier from `bevy_ecs_compile_fail_tests`. It is not in the workspace so the dependency version will not get automatically updated by cargo-release. - Change the author email to `41898282+github-actions[bot]@users.noreply.github.com`. According to the discussion [here](actions/checkout#13 (comment)) and [here](https://github.saobby.my.eu.orgmunity/t/github-actions-bot-email-address/17204/6), this is the email address associated with the github-actions bot account. - Also add the workflows to our release checklist. See infmagic2047#5 and infmagic2047#6 for examples of release and post-release PRs.
1 parent 08fca5b commit debd984

File tree

4 files changed

+74
-7
lines changed

4 files changed

+74
-7
lines changed

Diff for: .github/workflows/post-release.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Post-release version bump
2+
3+
# how to trigger: https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
4+
on:
5+
workflow_dispatch:
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
ci:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Install cargo-release
17+
run: cargo install cargo-release
18+
19+
- name: Setup post-release version bump
20+
run: |
21+
# Set the commit author to the github-actions bot. See discussion here for more information:
22+
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
23+
# https://github.saobby.my.eu.orgmunity/t/github-actions-bot-email-address/17204/6
24+
git config user.name 'Bevy Auto Releaser'
25+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
26+
# Read the current version from Cargo.toml
27+
current_version=$(cargo metadata --format-version 1 --no-deps | \
28+
jq --raw-output '.packages | .[] | select(.name == "bevy").version')
29+
# Sanity check: current version should be 0.X.Y
30+
if ! grep -q '^0\.[0-9]\+\.[0-9]\+$' <<< "${current_version}"; then
31+
echo "Invalid version (not in 0.X.Y format): ${current_version}"
32+
exit 1
33+
fi
34+
minor_version=$(sed 's/^0\.\([0-9]\+\).*/\1/' <<< "${current_version}")
35+
next_version=0.$((minor_version + 1)).0-dev
36+
echo "Bumping version to ${next_version}"
37+
# See release.yml for meaning of these arguments
38+
cargo release "${next_version}" \
39+
--workspace \
40+
--no-publish \
41+
--execute \
42+
--no-tag \
43+
--no-confirm \
44+
--no-push \
45+
--exclude ci \
46+
--exclude errors \
47+
--exclude bevy-ios-example \
48+
--exclude spancmp \
49+
--exclude build-wasm-example
50+
51+
- name: Create PR
52+
uses: peter-evans/create-pull-request@v3
53+
with:
54+
delete-branch: true
55+
base: "main"
56+
title: "Bump Version after Release"
57+
body: |
58+
Bump version after release
59+
This PR has been auto-generated

Diff for: .github/workflows/release.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,32 @@ jobs:
1818

1919
- name: Setup release
2020
run: |
21+
# Set the commit author to the github-actions bot. See discussion here for more information:
22+
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
23+
# https://github.saobby.my.eu.orgmunity/t/github-actions-bot-email-address/17204/6
2124
git config user.name 'Bevy Auto Releaser'
22-
git config user.email 'bevy@users.noreply.github.com'
25+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
26+
# release: remove the dev suffix, like going from 0.X.0-dev to 0.X.0
2327
# --workspace: updating all crates in the workspace
2428
# --no-publish: do not publish to crates.io
2529
# --execute: not a dry run
2630
# --no-tag: do not push tag for each new version
2731
# --no-push: do not push the update commits
32+
# --dependent-version upgrade: change 0.X.0-dev in internal dependencies to 0.X.0
2833
# --exclude: ignore those packages
29-
cargo release minor \
34+
cargo release release \
3035
--workspace \
3136
--no-publish \
3237
--execute \
3338
--no-tag \
3439
--no-confirm \
3540
--no-push \
41+
--dependent-version upgrade \
3642
--exclude ci \
3743
--exclude errors \
38-
--exclude bevy-ios-example
44+
--exclude bevy-ios-example \
45+
--exclude spancmp \
46+
--exclude build-wasm-example
3947
4048
- name: Create PR
4149
uses: peter-evans/create-pull-request@v3

Diff for: crates/bevy_ecs_compile_fail_tests/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_ecs_compile_fail_tests"
3-
version = "0.8.0-dev"
3+
version = "0.1.0"
44
edition = "2021"
55
description = "Compile fail tests for Bevy Engine's entity component system"
66
homepage = "https://bevyengine.org"
@@ -9,5 +9,5 @@ license = "MIT OR Apache-2.0"
99
publish = false
1010

1111
[dev-dependencies]
12-
bevy_ecs = { path = "../bevy_ecs", version = "0.8.0-dev" }
12+
bevy_ecs = { path = "../bevy_ecs" }
1313
trybuild = "1.0"

Diff for: docs/release_checklist.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
5. Create migration guide.
1010
6. Write blog post.
1111
7. Update book.
12-
8. Bump version number for all crates.
12+
8. Bump version number for all crates, using the "Release" workflow.
1313
9. Create tag on GitHub.
1414
10. Bump `latest` tag to most recent release.
1515

@@ -26,5 +26,5 @@
2626

2727
## Post-release
2828

29-
1. Bump version number for all crates to next versions, as `0.X-dev`, to ensure properly displayed version for [Dev Docs](https://dev-docs.bevyengine.org/bevy/index.html).
29+
1. Bump version number for all crates to next versions, as `0.X-dev`, using the "Post-release version bump" workflow, to ensure properly displayed version for [Dev Docs](https://dev-docs.bevyengine.org/bevy/index.html).
3030
2. Update Bevy version used for Bevy book code validation to latest release.

0 commit comments

Comments
 (0)