|
| 1 | +name: Release Readiness |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - "Cargo.toml" |
| 7 | + - "Cargo.lock" |
| 8 | + - "trail/Cargo.toml" |
| 9 | + - "trail/src/cli/command.rs" |
| 10 | + - "CHANGELOG.md" |
| 11 | + - "RELEASING.md" |
| 12 | + - ".github/workflows/release.yml" |
| 13 | + - ".github/workflows/publish-homebrew.yml" |
| 14 | + - ".github/workflows/release-readiness.yml" |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +jobs: |
| 18 | + package-smoke: |
| 19 | + name: Package smoke (${{ matrix.os }}) |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 24 | + runs-on: ${{ matrix.os }} |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v6 |
| 27 | + with: |
| 28 | + submodules: recursive |
| 29 | + - uses: dtolnay/rust-toolchain@stable |
| 30 | + - uses: Swatinem/rust-cache@v2 |
| 31 | + - name: Build release binary |
| 32 | + run: cargo build --locked -p trail --profile dist |
| 33 | + - name: Verify packaged CLI |
| 34 | + shell: bash |
| 35 | + run: | |
| 36 | + set -euo pipefail |
| 37 | + suffix="" |
| 38 | + if [[ "${RUNNER_OS}" == "Windows" ]]; then |
| 39 | + suffix=".exe" |
| 40 | + fi |
| 41 | + binary="${PWD}/target/dist/trail${suffix}" |
| 42 | + expected="$(sed -n '/^\[workspace.package\]/,/^\[/s/^version = "\([^"]*\)"/\1/p' Cargo.toml)" |
| 43 | + actual="$("${binary}" --version)" |
| 44 | + test "${actual}" = "trail ${expected}" |
| 45 | + "${binary}" --help >/dev/null |
| 46 | +
|
| 47 | + smoke_dir="$(mktemp -d)" |
| 48 | + trap 'rm -rf "${smoke_dir}"' EXIT |
| 49 | + cd "${smoke_dir}" |
| 50 | + printf 'release smoke test\n' > README.md |
| 51 | + "${binary}" init --working-tree |
| 52 | + "${binary}" status |
| 53 | +
|
| 54 | + dist-plan: |
| 55 | + name: Generated release workflow is current |
| 56 | + runs-on: ubuntu-latest |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v6 |
| 59 | + with: |
| 60 | + submodules: recursive |
| 61 | + - name: Install pinned dist |
| 62 | + shell: bash |
| 63 | + run: | |
| 64 | + curl --proto '=https' --tlsv1.2 -LsSf \ |
| 65 | + https://github.com/axodotdev/cargo-dist/releases/download/v0.32.0/cargo-dist-installer.sh | sh |
| 66 | + - name: Check release configuration |
| 67 | + run: | |
| 68 | + dist generate --mode=ci --check |
| 69 | + dist plan --tag="v$(sed -n '/^\[workspace.package\]/,/^\[/s/^version = "\([^"]*\)"/\1/p' Cargo.toml)" |
0 commit comments