-
Notifications
You must be signed in to change notification settings - Fork 3
143 lines (127 loc) · 4.84 KB
/
Copy pathrelease-prepare.yml
File metadata and controls
143 lines (127 loc) · 4.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Tag gate for a releasable build. Pushing a v* tag validates the tag, runs the
# full test suite, and builds the `pagedb-fsck` binaries once. Nothing is
# published and nothing leaves the repo.
#
# The manual `Release` workflow then consumes THIS run's binary artifacts by run
# ID for the GitHub Release, so a failure in the publish or release stage can be
# fixed and retried without repeating the tests or the compile.
#
# Artifacts are retained 14 days: that is the window in which a `Release` run can
# still resume from this prepare run.
name: Release Prepare
run-name: Release Prepare ${{ github.ref_name }}
on:
push:
tags:
- "v*"
concurrency:
group: release-prepare-${{ github.ref_name }}
cancel-in-progress: false
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
validate-version:
uses: ./.github/workflows/release-validate.yml
with:
ref: ${{ github.ref_name }}
# Full lint + cross-platform test + wasm/features/bench gates. Calls test.yml
# directly rather than ci.yml, whose PR-draft gate skips under workflow_call.
ci:
name: CI Gate
needs: validate-version
uses: ./.github/workflows/test.yml
# ── Build pagedb-fsck binary per target ─────────────────────────────────
build-binaries:
name: Build fsck (${{ matrix.label }})
needs: [validate-version, ci]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
label: linux-x64
ext: ""
- runs-on: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
label: linux-arm64
ext: ""
- runs-on: macos-latest
target: aarch64-apple-darwin
label: macos-arm64
ext: ""
# x86_64-apple-darwin cross-compiles on Apple Silicon; the Intel
# macos-13 image was retired, so build it on the arm64 runner.
- runs-on: macos-latest
target: x86_64-apple-darwin
label: macos-x64
ext: ""
- runs-on: windows-latest
target: x86_64-pc-windows-msvc
label: windows-x64
ext: ".exe"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Rust + target
uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
prefix-key: fsck-${{ matrix.target }}
- name: Set version from tag
shell: bash
run: bash scripts/ci/stamp_version.sh "${{ needs.validate-version.outputs.version }}"
- name: Build pagedb-fsck
run: cargo build --release --bin pagedb-fsck --target ${{ matrix.target }}
- name: Package (Unix)
if: runner.os != 'Windows'
run: |
set -euo pipefail
cd target/${{ matrix.target }}/release
chmod +x pagedb-fsck
tar czf pagedb-fsck-${{ needs.validate-version.outputs.version }}-${{ matrix.label }}.tar.gz pagedb-fsck
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd target/${{ matrix.target }}/release
$name = "pagedb-fsck-${{ needs.validate-version.outputs.version }}-${{ matrix.label }}.zip"
Compress-Archive -Path "pagedb-fsck${{ matrix.ext }}" -DestinationPath $name
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: fsck-${{ matrix.label }}
path: |
target/${{ matrix.target }}/release/pagedb-fsck-*.tar.gz
target/${{ matrix.target }}/release/pagedb-fsck-*.zip
if-no-files-found: error
retention-days: 14
summary:
name: Release instructions
needs: [validate-version, build-binaries]
runs-on: ubuntu-latest
steps:
- name: Write summary
env:
VERSION: ${{ needs.validate-version.outputs.version }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
run: |
{
echo "## Prepared v${VERSION}"
echo
echo "Tests passed and the fsck binaries are built. Publish with:"
echo
echo '```sh'
echo "gh workflow run release.yml -R ${REPO} \\"
echo " -f tag=v${VERSION} \\"
echo " -f prepare_run_id=${RUN_ID}"
echo '```'
echo
echo "If one stage fails, re-run the same command with only the"
echo "remaining stage enabled (e.g. \`-f publish_crate=false\`)."
echo "Nothing is recompiled."
} >> "$GITHUB_STEP_SUMMARY"