diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 620a859..d707732 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,16 +7,15 @@ on: workflow_dispatch: permissions: - contents: write - packages: write + contents: read jobs: release: name: ${{ github.ref_type == 'tag' && 'Release Binaries' || 'Release Binaries (Dry Run)' }} runs-on: ubuntu-latest timeout-minutes: 60 + environment: publish env: - GITHUB_TOKEN: ${{ secrets.GH_PAT }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }} MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }} @@ -31,6 +30,25 @@ jobs: with: go-version-file: go.mod cache: true + - name: Create release app token for this repo + if: github.ref_type == 'tag' + id: app-token + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 + with: + app-id: ${{ secrets.RELEASE_APP_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + permission-contents: write + - name: Create release app token for homebrew-tools + if: github.ref_type == 'tag' + id: tap-token + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 + with: + app-id: ${{ secrets.RELEASE_APP_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + owner: openai + repositories: homebrew-tools + permission-contents: write + permission-pull-requests: write - name: Release if: github.ref_type == 'tag' uses: goreleaser/goreleaser-action@v7 @@ -38,6 +56,9 @@ jobs: distribution: goreleaser-pro version: "~> v2" args: release --clean + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.tap-token.outputs.token }} - name: Release dry run if: github.ref_type != 'tag' uses: goreleaser/goreleaser-action@v7 @@ -58,6 +79,9 @@ jobs: needs: release runs-on: ubuntu-latest timeout-minutes: 60 + permissions: + contents: read + packages: write steps: - uses: actions/checkout@v6 - uses: docker/setup-qemu-action@v4 diff --git a/.goreleaser.yml b/.goreleaser.yml index 3643afb..74473a9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -48,8 +48,12 @@ brews: ids: - regular repository: - owner: cirruslabs - name: homebrew-cli + owner: openai + name: homebrew-tools + token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" + branch: "orchard-{{ .Version }}" + pull_request: + enabled: true install: | bin.install "orchard" generate_completions_from_executable(bin/"orchard", "completion")