Add notice for buf-action #27
Workflow file for this run
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
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 | |
env: | |
APP_ID: 257262 | |
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: 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 | |
with: | |
token: ${{ steps.app_token.outputs.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: ${{ steps.app_token.outputs.token }} |