chore: release v2.18.0 (#514) #92
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: publish-cli | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| concurrency: | |
| group: publish-cli-${{ github.ref_name }} | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_TERM_COLOR: always | |
| DRY_RUN: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_CONFIG_FUND: false | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2 | |
| - name: Create draft release | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| run: | | |
| TAG_NAME="${{ github.ref_name }}" | |
| awk '/^## \[/{if(found) exit; found=1} found{print}' CHANGELOG.md >/tmp/release-notes.txt | |
| BODY=$(cat /tmp/release-notes.txt) | |
| # GitHub may not have indexed the tag yet after a push. Draft releases | |
| # created before indexing get "untagged-*" placeholder tag names. | |
| for attempt in $(seq 1 30); do | |
| RESPONSE=$(gh api repos/${{ github.repository }}/releases \ | |
| --method POST \ | |
| -f tag_name="$TAG_NAME" \ | |
| -f target_commitish="$GITHUB_SHA" \ | |
| -f name="$TAG_NAME" \ | |
| -f body="$BODY" \ | |
| -F draft=true) | |
| ACTUAL_TAG=$(echo "$RESPONSE" | jq -r '.tag_name') | |
| if [ "$ACTUAL_TAG" = "$TAG_NAME" ]; then | |
| echo "$RESPONSE" | jq -r '.html_url' | |
| exit 0 | |
| fi | |
| RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id') | |
| gh api "repos/${{ github.repository }}/releases/$RELEASE_ID" --method DELETE --silent | |
| echo "Tag not yet indexed (got $ACTUAL_TAG), retrying in 5s... (attempt $attempt/30)" | |
| sleep 5 | |
| done | |
| echo "::error::Failed to create release with correct tag after 30 attempts" | |
| exit 1 | |
| build-and-publish: | |
| needs: [create-release] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: universal-apple-darwin | |
| os: macos-latest | |
| build-tool: cargo | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| build-tool: cross | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| build-tool: cross | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| build-tool: cross | |
| - target: aarch64-unknown-linux-musl | |
| os: ubuntu-latest | |
| build-tool: cross | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| build-tool: cargo | |
| - target: aarch64-pc-windows-msvc | |
| os: windows-latest | |
| build-tool: cargo | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: recursive | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2 | |
| with: | |
| experimental: true | |
| - if: matrix.os == 'macos-latest' | |
| uses: apple-actions/import-codesign-certs@b610f78488812c1e56b20e6df63ec42d833f2d14 # v6 | |
| with: | |
| p12-file-base64: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12 }} | |
| p12-password: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12_PASS }} | |
| - uses: taiki-e/upload-rust-binary-action@f391289bcff6a7f36b6301c0a74199657bbb4561 # v1 | |
| with: | |
| bin: usage | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| target: ${{ matrix.target }} | |
| build-tool: ${{ matrix.build-tool }} | |
| manifest-path: cli/Cargo.toml | |
| include: cli/assets/usage.1 | |
| codesign: "Developer ID Application: Jeffrey Dickey (4993Y37DX6)" | |
| codesign_prefix: dev.jdx. | |
| dry-run: ${{ github.event_name == 'workflow_dispatch' }} | |
| env: | |
| CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1 | |
| CARGO_PROFILE_RELEASE_LTO: true | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [build-and-publish] | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: recursive | |
| - uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2 | |
| - run: gh release edit ${{ github.ref_name }} --draft=false | |
| if: ${{ github.event_name != 'workflow_dispatch' }} | |
| enhance-release: | |
| runs-on: ubuntu-latest | |
| needs: [release] | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2 | |
| - run: communique generate "${{ github.ref_name }}" --github-release | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| # bump-homebrew-formula: | |
| # runs-on: macos-latest | |
| # needs: [release] | |
| # timeout-minutes: 10 | |
| # continue-on-error: true | |
| # if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| # steps: | |
| # - name: Bump Homebrew formula | |
| # uses: dawidd6/action-homebrew-bump-formula@3428a0601bba3173ec0bdcc945be23fa27aa4c31 # v5 | |
| # with: | |
| # token: ${{ secrets.GH_BOT_TOKEN }} | |
| # formula: usage |