Skip to content

Commit 59b90a2

Browse files
committed
Prepare for an automated release process
Over in https://github.com/ahamlinman/yaml-split, I've tested out a new release workflow where: 1. I push the release commit. 2. GitHub Actions runs all of the deep tests and builds all of the release archives for that commit. 3. Then, GitHub Actions fast-forwards main to the release commit and pushes a signed tag. 4. Then, GitHub Actions publishes the GitHub Release. The key to this workflow is that a signed release tag is not pushed until _after_ we can be confident that the release is valid, with all tests passing on all platforms and all desired artifacts built. It's my attempt to apply the [not rocket science][1] concept to my releases, rather than to the main branch (where the low level of activity on this project reduces its value). This came out of me (thankfully) testing my release builds after the recent chunker work, and finding that Linux Arm builds were failing due to the incorrect char definition in unsafe-libyaml. Since I don't have that target running tests, a deep test run wouldn't have caught this before me triggering a release with a signed tag, and I would have been in the embarrassing position of cutting a follow-up release to fix it (since I'm certainly not force-pushing a tag change). I think I'll make a few more tweaks to these workflows in yaml-split before I activate the full workflow over here. Plus, I need to get my GPG key sorted out for signing the new tags. I just want to try this limited form on the xt repo to make sure the basics work. [1]: https://graydon2.dreamwidth.org/1597.html
1 parent fab1a6c commit 59b90a2

File tree

4 files changed

+182
-48
lines changed

4 files changed

+182
-48
lines changed

.github/workflows/xt-release.yml renamed to .github/workflows/build-release-archives.yml

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
2-
name: xt Release
2+
name: Build Release Archives
3+
34
on:
5+
workflow_call: {}
46
workflow_dispatch: {}
5-
push:
6-
tags: ['v[0-9]+.[0-9]+.[0-9]+']
7+
78
env:
89
CARGO_TERM_COLOR: always
10+
911
jobs:
1012
build-doc:
1113
runs-on: ubuntu-24.04
@@ -61,7 +63,7 @@ jobs:
6163
name: target-${{ matrix.target }}
6264
path: target.tar.gz
6365

64-
create-release:
66+
assemble-archives:
6567
needs: [build-doc, build-binaries-unix]
6668
runs-on: ubuntu-24.04
6769
permissions:
@@ -79,32 +81,9 @@ jobs:
7981
done
8082
(cd dist && sha256sum xt-*.tar.gz > SHA256SUMS)
8183
- name: Upload Release Artifacts
82-
if: startsWith(github.ref, 'refs/heads/')
8384
uses: actions/upload-artifact@v4
8485
with:
8586
name: release
8687
path: |
8788
dist/xt-*.tar.gz
8889
dist/SHA256SUMS
89-
- name: Create Release
90-
uses: softprops/action-gh-release@v2
91-
if: startsWith(github.ref, 'refs/tags/')
92-
with:
93-
files: |
94-
dist/xt-*.tar.gz
95-
dist/SHA256SUMS
96-
body: >-
97-
**[See the xt CHANGELOG][changelog] for release information.**
98-
99-
100-
Binary releases of xt are available for Linux and macOS as
101-
attachments to this GitHub Release. They are statically linked (on
102-
Linux), or link only to the platform's standard libraries (on macOS).
103-
Before using them, review the [Installation][install] section of the
104-
xt README. Your platform may support a more robust installation
105-
mechanism.
106-
107-
108-
[changelog]: https://github.com/ahamlinman/xt/blob/main/CHANGELOG.md
109-
110-
[install]: https://github.com/ahamlinman/xt?tab=readme-ov-file#installation
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,62 @@
11
---
2-
name: xt Full Test Matrix
3-
on: workflow_dispatch
2+
name: Deep Tests
3+
4+
on:
5+
workflow_call: {}
6+
workflow_dispatch: {}
7+
48
env:
59
CARGO_TERM_COLOR: always
610
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
11+
712
jobs:
13+
cargo-publish-dry-run:
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Download Toolchain
19+
run: |
20+
rustup set profile minimal
21+
rustup toolchain install stable
22+
rustup default stable
23+
rustc --version
24+
- name: Try Publishing
25+
run: cargo publish --dry-run
26+
827
stable-msrv-test:
928
strategy:
1029
fail-fast: false
1130
matrix:
1231
runner: [ubuntu-24.04, macos-14, windows-2022]
13-
toolchain: [stable, 1.70.0]
32+
toolchain: [stable, '1.70.0']
1433
runs-on: ${{ matrix.runner }}
1534
steps:
16-
- name: git checkout
35+
- name: Checkout
1736
uses: actions/checkout@v4
18-
- name: rustup toolchain install
37+
- name: Download Toolchain
1938
run: |
2039
rustup set profile minimal
2140
rustup toolchain install ${{ matrix.toolchain }}
2241
rustup default ${{ matrix.toolchain }}
2342
rustc --version
24-
- name: cargo check
43+
- name: Check
2544
run: cargo check
26-
- name: cargo test
45+
- name: Test
2746
run: cargo test
47+
2848
linux-miri-test:
2949
runs-on: ubuntu-24.04
3050
steps:
31-
- name: git checkout
51+
- name: Checkout
3252
uses: actions/checkout@v4
33-
- name: rustup toolchain install
53+
- name: Download Toolchain
3454
run: |
3555
rustup set profile minimal
3656
rustup toolchain install nightly --component miri --allow-downgrade
3757
rustup default nightly
3858
rustc --version
39-
- name: download nextest
59+
- name: Download Nextest
4060
run: curl -LsSf https://get.nexte.st/0.9/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
41-
- name: cargo miri test
61+
- name: Test in Miri
4262
run: cargo miri nextest run -j num-cpus
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,45 @@
11
---
2-
name: xt Main Tests
2+
name: Main Tests
3+
34
on:
45
push:
56
branches: [main]
7+
68
env:
79
CARGO_TERM_COLOR: always
810
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
11+
912
jobs:
1013
stable-test-lint:
1114
runs-on: ubuntu-24.04
1215
steps:
13-
- name: git checkout
16+
- name: Checkout
1417
uses: actions/checkout@v4
15-
- name: rustup toolchain install
18+
- name: Download Toolchain
1619
run: |
1720
rustup set profile minimal
1821
rustup toolchain install stable --component clippy --component rustfmt
1922
rustup default stable
2023
rustc --version
21-
- name: cargo check
24+
- name: Check
2225
run: cargo check
23-
- name: cargo test
26+
- name: Test
2427
run: cargo test
25-
- name: cargo clippy
28+
- name: Clippy
2629
run: cargo clippy
30+
2731
msrv-test:
2832
runs-on: ubuntu-24.04
2933
steps:
30-
- name: git checkout
34+
- name: Checkout
3135
uses: actions/checkout@v4
32-
- name: rustup toolchain install
36+
- name: Download Toolchain
3337
run: |
3438
rustup set profile minimal
3539
rustup toolchain install 1.70.0
3640
rustup default 1.70.0
3741
rustc --version
38-
- name: cargo check
42+
- name: Check
3943
run: cargo check
40-
- name: cargo test
44+
- name: Test
4145
run: cargo test
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
name: Release Process
3+
4+
on:
5+
push:
6+
branches: [start-release]
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
check-release-branch:
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
filter: blob:none
19+
fetch-depth: 0
20+
- name: Check Release Branch
21+
id: check-release
22+
run: |
23+
set -x
24+
25+
release_version="$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')"
26+
release_branch="${GITHUB_REF#refs/heads/}"
27+
release_tag="v${release_version}"
28+
commit_title="$(git show --pretty=format:%s --no-patch)"
29+
30+
if [[ ! $release_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
31+
echo "$release_version is not a release version"
32+
exit 1
33+
elif [[ $commit_title != "Release $release_tag" ]]; then
34+
echo "'$commit_title' is not a release commit title"
35+
exit 1
36+
fi
37+
38+
git checkout main
39+
git merge --no-commit --ff-only "$release_branch"
40+
41+
echo "release_version=$release_version" >> "$GITHUB_OUTPUT"
42+
echo "release_branch=$release_branch" >> "$GITHUB_OUTPUT"
43+
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
44+
outputs:
45+
release_version: ${{ steps.check-release.outputs.release_version }}
46+
release_branch: ${{ steps.check-release.outputs.release_branch }}
47+
release_tag: ${{ steps.check-release.outputs.release_tag }}
48+
49+
run-deep-tests:
50+
needs: check-release-branch
51+
uses: ./.github/workflows/deep-tests.yml
52+
53+
build-archives:
54+
needs: check-release-branch
55+
uses: ./.github/workflows/build-release-archives.yml
56+
permissions:
57+
contents: write
58+
59+
# merge-release:
60+
# needs:
61+
# - check-release-branch
62+
# - run-deep-tests
63+
# - build-archives
64+
# runs-on: ubuntu-24.04
65+
# permissions:
66+
# contents: write
67+
# steps:
68+
# - name: Checkout
69+
# uses: actions/checkout@v4
70+
# with:
71+
# filter: blob:none
72+
# fetch-depth: 0
73+
# - name: Import Signing Key
74+
# run: gpg --batch --import <<< "$GPG_PRIVATE_KEY"
75+
# env:
76+
# GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
77+
# - name: Merge Release
78+
# run: |
79+
# set -x
80+
81+
# release_branch="${{ needs.check-release-branch.outputs.release_branch }}"
82+
# release_tag="${{ needs.check-release-branch.outputs.release_tag }}"
83+
# gpg_key_id="${{ vars.GPG_KEY_ID }}"
84+
85+
# git config --global user.name "github-actions[bot]"
86+
# git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
87+
88+
# git tag -asu "$gpg_key_id" -m "$release_tag" "$release_tag"
89+
90+
# git checkout main
91+
# git merge --ff-only "$release_branch"
92+
93+
# git push origin main "$release_tag" :"$release_branch"
94+
95+
# create-github-release:
96+
# needs:
97+
# - check-release-branch
98+
# - build-archives
99+
# - merge-release
100+
# runs-on: ubuntu-24.04
101+
# permissions:
102+
# contents: write
103+
# steps:
104+
# - name: Download Artifacts
105+
# uses: actions/download-artifact@v4
106+
# with:
107+
# name: release
108+
# - name: List Artifacts
109+
# run: ls -lR
110+
# - name: Create Release
111+
# uses: softprops/action-gh-release@v2
112+
# with:
113+
# tag_name: ${{ needs.check-release-branch.outputs.release_tag }}
114+
# files: |
115+
# xt-*.tar.gz
116+
# SHA256SUMS
117+
# body: >-
118+
# **[See the xt CHANGELOG][changelog] for release information.**
119+
120+
121+
# Binary releases of xt are available for Linux and macOS as
122+
# attachments to this GitHub Release. They are statically linked (on
123+
# Linux), or link only to the platform's standard libraries (on macOS).
124+
# Before using them, review the [Installation][install] section of the
125+
# xt README. Your platform may support a more robust installation
126+
# mechanism.
127+
128+
129+
# [changelog]: https://github.com/ahamlinman/xt/blob/main/CHANGELOG.md
130+
131+
# [install]: https://github.com/ahamlinman/xt?tab=readme-ov-file#installation

0 commit comments

Comments
 (0)