-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split `release.yaml` into `create-release-pr.yaml` and `draft-release.yaml`. Remove `test.yaml`, seems like it shouldn't be on main in the first place?
- Loading branch information
1 parent
1158f4f
commit 81bf726
Showing
4 changed files
with
90 additions
and
124 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,49 @@ | ||
name: Create Release PR | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: string | ||
description: The version you intend to release (eg x.y.z) | ||
required: true | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
env: | ||
VERSION: ${{ github.event.inputs.version }} | ||
APP_ID: 257262 | ||
jobs: | ||
update_version: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.inputs.version != '' }} | ||
steps: | ||
- name: Validate input version | ||
if: ${{ startsWith(github.event.inputs.version, 'v') }} | ||
run: | | ||
echo "error: version must not start with 'v'." | ||
exit 1 | ||
- name: Get GitHub app token | ||
uses: actions/create-github-app-token@v1 | ||
id: app_token | ||
with: | ||
app-id: ${{ env.APP_ID }} | ||
private-key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }} | ||
- name: Checkout repository code | ||
uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '^1.19.x' | ||
- name: Update docs Version | ||
run: make updateversion VERSION=${{env.VERSION}} | ||
- name: Create PR | ||
run: | | ||
git config user.name "${{ github.actor }}" | ||
git config user.email "${{ github.actor }}@users.noreply.github.com" | ||
BRANCH="release/v${VERSION}" | ||
git switch -C ${BRANCH} | ||
git add . | ||
git commit -m "Update version to ${VERSION}" | ||
git push --set-upstream origin --force ${BRANCH} | ||
gh pr create --title "Release v${VERSION}" --body "Release prepared for ${VERSION}" | ||
env: | ||
GH_TOKEN: ${{ steps.app_token.outputs.token }} |
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,41 @@ | ||
name: Draft Release | ||
on: | ||
pull_request: | ||
types: [closed] | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: string | ||
description: The released CLI version without 'v'. For example, 1.0.0. | ||
permissions: | ||
contents: write | ||
jobs: | ||
draft_release: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release')) }} | ||
steps: | ||
- name: Validate input version | ||
if: ${{ startsWith(github.event.inputs.version, 'v') }} | ||
run: | | ||
echo "error: version must not start with 'v'." | ||
exit 1 | ||
- name: Set VERSION variable | ||
# The head ref looks like release/v1.0.0, and we need to trim the string up to the `/v`. | ||
run: | | ||
VERSION="${{ github.event.inputs.version || github.head_ref}}" | ||
echo "VERSION=${VERSION##*/v}" >> $GITHUB_ENV | ||
- name: Checkout repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
- name: Sync v1 branch | ||
run: | | ||
git fetch origin | ||
git switch v1 | ||
git merge origin/main | ||
git push origin v1 | ||
- name: Release | ||
run: gh release create --draft --title "v${VERSION}" "v${VERSION}" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.