-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
```sh cd "${BUFBUILD_BUF_SETUP_ACTION_DIR}" git switch main git pull origin main make updateversion VERSION=${VERSION} git diff git checkout -b release/v${VERSION} git commit -am "Update to v${VERSION}" git push origin release/v${VERSION} # Get that PR approved and merged git switch main git pull origin main git tag -a "v${VERSION}" -m "v${VERSION}" git push origin "v${VERSION}" ``` Resolves [TCN-680](https://linear.app/bufbuild/issue/TCN-680)
- Loading branch information
1 parent
43eec1e
commit a8ba580
Showing
3 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: string | ||
description: The version you intend to release (eg x.y.z) | ||
required: true | ||
|
||
env: | ||
VERSION: v${{ github.event.inputs.version }} | ||
APP_ID: 257262 | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: tibdex/github-app-token@v1 | ||
with: | ||
app_id: ${{env.APP_ID}} | ||
private_key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }} | ||
repository: ${{ github.repository }} | ||
permissions: >- | ||
{"contents": "write", "pull_requests": "write"} | ||
- name: Checkout repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '^1.19.x' | ||
- name: Update docs Version | ||
run: make updateversion VERSION=${{env.VERSION}} | ||
- name: Create PR | ||
id: cpr | ||
uses: peter-evans/create-pull-request@ad43dccb4d726ca8514126628bec209b8354b6dd | ||
with: | ||
add-paths: . | ||
commit-message: "Update version to ${{env.VERSION}}" | ||
branch: release/${{env.VERSION}} | ||
delete-branch: true | ||
title: "Release ${{env.VERSION}}" | ||
body: Release prepared for ${{env.VERSION}} | ||
token: ${{ steps.generate_token.outputs.token }} | ||
tag: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release') }} | ||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: tibdex/github-app-token@v1 | ||
with: | ||
app_id: ${{env.APP_ID}} | ||
private_key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }} | ||
repository: ${{ github.repository }} | ||
permissions: >- | ||
{"contents": "write"} | ||
- name: Set VERSION variable from tag | ||
run: | | ||
VERSION=${{github.head_ref}} | ||
echo "VERSION=${VERSION##*/}" >> $GITHUB_ENV | ||
- name: Checkout repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
fetch-depth: 0 | ||
- name: Tag Release | ||
run: | | ||
git config --global user.password ${{ steps.generate_token.outputs.token }} | ||
git tag -d ${{env.VERSION}} 2> /dev/null || echo 'local ref does not exist' | ||
git push origin :${{env.VERSION}} 2> /dev/null || echo 'remote ref does not exist' | ||
git tag ${{env.VERSION}} | ||
git push origin ${{env.VERSION}} |
This file contains 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
This file contains 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