Repository navigation
fix(release): use built-in GITHUB_TOKEN in release pipeline #1734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ on: | |
| # GitHub considers creating releases and uploading assets as writing contents. | ||
| permissions: | ||
| contents: write | ||
| issues: write | ||
|
|
||
| jobs: | ||
| goreleaser: | ||
|
|
@@ -72,18 +73,41 @@ jobs: | |
| AUTHKEY_BASE64: ${{ secrets.APPLE_API_KEY }} | ||
| - name: Install Snapcraft | ||
| uses: samuelmeuli/action-snapcraft@v3 | ||
|
|
||
|
|
||
| - name: Ensure tap fork exists | ||
| run: | | ||
| # Create fork with suffix `-fork` to indicate that the repo in the technical users account is just a fork | ||
| gh repo fork stackitcloud/homebrew-tap \ | ||
| --fork-name homebrew-tap-fork \ | ||
| --clone=false || true | ||
| env: | ||
| GH_TOKEN: ${{ secrets.CLI_RELEASE }} | ||
|
|
||
| - name: Run GoReleaser | ||
| uses: goreleaser/[email protected] | ||
| with: | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.CLI_RELEASE }} | ||
| # GITHUB_TOKEN is used to create the GitHub release in this repository. | ||
| # It uses the workflow-level permissions defined above. | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
|
marceljk marked this conversation as resolved.
Resolved
|
||
| # HOMEBREW_RELEASE_TOKEN is a PAT belonging to the `stackit-pipeline` user. | ||
| # It is used by GoReleaser to push to the tap fork and open the upstream Homebrew PR. | ||
| HOMEBREW_RELEASE_TOKEN: ${{ secrets.CLI_RELEASE }} | ||
| GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
| GPG_KEY_PATH: ${{ env.GPG_KEY_PATH }} | ||
| # nfpm-rpm signing needs this env to be set. | ||
| NFPM_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
|
|
||
| - name: Create issue to inform about Homebrew PR | ||
| run: | | ||
| gh issue create \ | ||
| --repo "${{ github.repository }}" \ | ||
| --title "Homebrew Cask PR opened for ${{ github.ref_name }}" \ | ||
| --body "A pull request has been automatically created for release **${{ github.ref_name }}**" | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
|
|
||
| - name: Clean up GPG key file | ||
| if: always() | ||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,8 +133,17 @@ homebrew_casks: | |
| - name: stackit | ||
| directory: Casks | ||
| repository: | ||
| owner: stackitcloud | ||
| name: homebrew-tap | ||
| # Update of the homebrew cask is created via a fork of the homebrew tap | ||
| owner: stackit-pipeline | ||
| name: homebrew-tap-fork | ||
|
rubenhoenle marked this conversation as resolved.
Resolved
|
||
| token: "{{ .Env.HOMEBREW_RELEASE_TOKEN }}" | ||
| branch: "{{.ProjectName}}-{{.Version}}" | ||
| pull_request: | ||
| enabled: true | ||
| base: | ||
| owner: stackitcloud | ||
| name: homebrew-tap | ||
| branch: main | ||
| commit_author: | ||
| name: CLI Release Bot | ||
| email: [email protected] | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.