fix: execute config commands in declaration order instead of alphabet… #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| jobs: | |
| check: | |
| name: CI checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Rust checks | |
| run: cargo fmt --check && cargo clippy -- -D warnings && cargo build && cargo test | |
| build: | |
| name: Build ${{ matrix.target }} | |
| needs: check | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Build release binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package artifact | |
| shell: bash | |
| run: | | |
| tag="${GITHUB_REF#refs/tags/}" | |
| name="bugatti-${tag}-${{ matrix.target }}" | |
| mkdir -p "dist/${name}" | |
| cp "target/${{ matrix.target }}/release/bugatti" "dist/${name}/" | |
| cd dist | |
| tar czf "${name}.tar.gz" "${name}" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bugatti-${{ matrix.target }} | |
| path: dist/*.tar.gz | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Generate checksums | |
| run: | | |
| cd artifacts | |
| sha256sum *.tar.gz > checksums-sha256.txt | |
| - name: Extract changelog for release | |
| id: changelog | |
| run: | | |
| tag="${GITHUB_REF#refs/tags/}" | |
| version="${tag#v}" | |
| # Extract the section between this version's heading and the next heading | |
| notes=$(awk -v ver="$version" ' | |
| /^## \[/ { | |
| if (found) exit | |
| if ($0 ~ "\\[" ver "\\]") found=1; next | |
| } | |
| found { print } | |
| ' CHANGELOG.md) | |
| # Fail if we got nothing — forces you to update CHANGELOG.md before tagging | |
| if [ -z "$notes" ]; then | |
| echo "::error::No CHANGELOG.md entry found for version ${version}" | |
| exit 1 | |
| fi | |
| # Write to file to avoid quoting issues | |
| echo "$notes" > release-notes.md | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| tag="${GITHUB_REF#refs/tags/}" | |
| gh release create "${tag}" \ | |
| --title "${tag}" \ | |
| --notes-file release-notes.md \ | |
| --draft \ | |
| artifacts/*.tar.gz \ | |
| artifacts/checksums-sha256.txt |