|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + release: |
| 14 | + name: Release |
| 15 | + if: github.event_name == 'push' && github.ref_type == 'tag' |
| 16 | + runs-on: ghcr.io/cirruslabs/macos-runner:tahoe |
| 17 | + environment: publish |
| 18 | + timeout-minutes: 60 |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v6 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + persist-credentials: false |
| 24 | + - name: Install Rust |
| 25 | + run: | |
| 26 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal |
| 27 | + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" |
| 28 | + - name: Install release targets |
| 29 | + run: rustup target add aarch64-apple-darwin x86_64-apple-darwin |
| 30 | + - name: Create release app token for this repo |
| 31 | + id: app-token |
| 32 | + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 |
| 33 | + with: |
| 34 | + app-id: ${{ secrets.RELEASE_APP_ID }} |
| 35 | + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} |
| 36 | + permission-contents: write |
| 37 | + - name: Create release app token for homebrew-tools |
| 38 | + id: tap-token |
| 39 | + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 |
| 40 | + with: |
| 41 | + app-id: ${{ secrets.RELEASE_APP_ID }} |
| 42 | + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} |
| 43 | + owner: openai |
| 44 | + repositories: homebrew-tools |
| 45 | + permission-contents: write |
| 46 | + permission-pull-requests: write |
| 47 | + - name: Release |
| 48 | + uses: goreleaser/goreleaser-action@v7 |
| 49 | + with: |
| 50 | + distribution: goreleaser-pro |
| 51 | + version: "~> v2" |
| 52 | + args: release --clean |
| 53 | + env: |
| 54 | + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |
| 55 | + HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.tap-token.outputs.token }} |
| 56 | + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
| 57 | + |
| 58 | + snapshot: |
| 59 | + name: Release (Dry Run) |
| 60 | + if: github.event_name == 'workflow_dispatch' |
| 61 | + runs-on: ghcr.io/cirruslabs/macos-runner:tahoe |
| 62 | + timeout-minutes: 60 |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v6 |
| 65 | + with: |
| 66 | + fetch-depth: 0 |
| 67 | + persist-credentials: false |
| 68 | + - name: Install Rust |
| 69 | + run: | |
| 70 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal |
| 71 | + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" |
| 72 | + - name: Install release targets |
| 73 | + run: rustup target add aarch64-apple-darwin x86_64-apple-darwin |
| 74 | + - name: Release dry run |
| 75 | + uses: goreleaser/goreleaser-action@v7 |
| 76 | + with: |
| 77 | + distribution: goreleaser-pro |
| 78 | + version: "~> v2" |
| 79 | + args: release --skip=publish --snapshot --clean |
| 80 | + - name: Upload dry-run artifacts |
| 81 | + uses: actions/upload-artifact@v6 |
| 82 | + with: |
| 83 | + name: softnet-snapshot |
| 84 | + path: dist/** |
0 commit comments