chore(release): prepare for v0.30.3 #89
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[0-9]+.[0-9]+.[0-9]+" | |
| jobs: | |
| build-artifact: | |
| runs-on: ${{ matrix.os }} | |
| environment: release | |
| permissions: | |
| contents: write | |
| env: | |
| BUILD_NAME: "gitu-${{ github.ref_name }}-${{ matrix.target }}" | |
| strategy: | |
| matrix: | |
| build: [linux-x64, windows-x64, macos-x64, macos-arm64] | |
| include: | |
| - build: linux-x64 | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - build: windows-x64 | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| - build: macos-x64 | |
| os: macos-13 | |
| target: x86_64-apple-darwin | |
| - build: macos-arm64 | |
| os: macos-latest | |
| target: aarch64-apple-darwin | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 50 | |
| - name: Fetch tags | |
| run: git fetch --tags --force | |
| - name: Cache | |
| uses: actions/[email protected] | |
| with: | |
| path: | | |
| ~/.cargo/bin | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build release binary | |
| run: cargo build --verbose --release --locked --target ${{ matrix.target }} | |
| - name: Bundle release | |
| shell: bash | |
| run: | | |
| mkdir -p "$BUILD_NAME" | |
| cp {README.md,LICENSE} "$BUILD_NAME/" | |
| cp "target/${{ matrix.target }}/release/gitu" "$BUILD_NAME/" | |
| - name: Run smoke test | |
| shell: bash | |
| run: | | |
| "$BUILD_NAME/gitu" --version | |
| - name: Upload asset | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BUILD_NAME }} | |
| path: ${{ env.BUILD_NAME }} | |
| verify: | |
| needs: ['build-artifact'] | |
| runs-on: ubuntu-latest | |
| environment: release | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 50 | |
| - name: Fetch tags | |
| run: git fetch --tags --force | |
| - name: Cargo publish dry-run | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| run: | | |
| cargo publish --dry-run | |
| cargo-publish: | |
| needs: ['build-artifact', 'verify'] | |
| runs-on: ubuntu-latest | |
| environment: release | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 50 | |
| - name: Fetch tags | |
| run: git fetch --tags --force | |
| - name: Cargo publish | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| run: | | |
| cargo publish | |
| create-github-release: | |
| needs: ['build-artifact', 'verify'] | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: write | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Checkout .recent-changelog-entry | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: .recent-changelog-entry | |
| sparse-checkout-cone-mode: false | |
| - name: Download all workflow run artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Github release | |
| working-directory: artifacts | |
| run: | | |
| gh release create "$GITHUB_REF_NAME" -F ../.recent-changelog-entry | |
| ls | xargs -I{} zip -r {}.zip {} | |
| ls *.zip | xargs gh release upload "$GITHUB_REF_NAME" |