bump version to 0.2.0 #11
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: CI | |
| on: | |
| push: | |
| tags: ["v*.*.*"] | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| qa: | |
| name: QA | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Check formatting | |
| run: cargo fmt -- --check | |
| - name: Clippy | |
| run: cargo clippy -- -D warnings | |
| - name: Test | |
| run: cargo test --all | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [qa] | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| cross: false | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| cross: true | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| cross: true | |
| - target: aarch64-unknown-linux-musl | |
| os: ubuntu-latest | |
| cross: true | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| cross: false | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| cross: false | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| cross: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - name: Install cross | |
| if: matrix.cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build | |
| run: | | |
| if [ "${{ matrix.cross }}" = "true" ]; then | |
| cross build --release --target ${{ matrix.target }} | |
| else | |
| cargo build --release --target ${{ matrix.target }} | |
| fi | |
| shell: bash | |
| - name: Extract version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: Package (unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar czf ../../../trunks_${{ steps.version.outputs.VERSION }}_${{ matrix.target }}.tar.gz trunks | |
| shell: bash | |
| - name: Package (windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| "/c/Program Files/7-Zip/7z.exe" a ../../../trunks_${{ steps.version.outputs.VERSION }}_${{ matrix.target }}.zip trunks.exe | |
| shell: bash | |
| - name: Upload artifact (unix) | |
| if: matrix.os != 'windows-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: trunks_${{ steps.version.outputs.VERSION }}_${{ matrix.target }}.tar.gz | |
| path: trunks_${{ steps.version.outputs.VERSION }}_${{ matrix.target }}.tar.gz | |
| - name: Upload artifact (windows) | |
| if: matrix.os == 'windows-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: trunks_${{ steps.version.outputs.VERSION }}_${{ matrix.target }}.zip | |
| path: trunks_${{ steps.version.outputs.VERSION }}_${{ matrix.target }}.zip | |
| release: | |
| name: Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [qa, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Collect release assets | |
| run: | | |
| mkdir -p release | |
| find artifacts -type f \( -name '*.tar.gz' -o -name '*.zip' \) -exec mv {} release/ \; | |
| - name: Generate checksums | |
| run: | | |
| cd release | |
| sha256sum * > SHA256SUMS | |
| shell: bash | |
| - name: Generate release notes | |
| id: notes | |
| run: | | |
| PREV_TAG=$(git describe --tags --abbrev=0 "${{ github.ref_name }}^" 2>/dev/null || true) | |
| DELIM="EOF_$(date +%s%N)" | |
| if [ -z "$PREV_TAG" ]; then | |
| echo "NOTES<<$DELIM" >> "$GITHUB_OUTPUT" | |
| echo "Initial release." >> "$GITHUB_OUTPUT" | |
| echo "$DELIM" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "NOTES<<$DELIM" >> "$GITHUB_OUTPUT" | |
| git log --pretty=format:"- %s (%h)" "${PREV_TAG}..${{ github.ref_name }}" >> "$GITHUB_OUTPUT" | |
| echo "" >> "$GITHUB_OUTPUT" | |
| echo "$DELIM" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| name: trunks ${{ github.ref_name }} | |
| body: ${{ steps.notes.outputs.NOTES }} | |
| files: release/* | |
| publish: | |
| name: Publish to crates.io | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [qa] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Authenticate with crates.io | |
| uses: rust-lang/crates-io-auth-action@v1 | |
| id: auth | |
| - name: Publish trunks (lib) | |
| run: cargo publish -p trunks | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} | |
| - name: Publish trunks-cli | |
| run: cargo publish -p trunks-cli | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} |