pulumi/.github/workflows/release-pr.yml

76 lines
2.2 KiB
YAML

name: Post-Release PR
permissions:
# To create a PR
contents: write
pull-requests: write
on:
workflow_call:
inputs:
ref:
required: true
description: "GitHub ref to use"
type: string
version:
required: true
description: "Version to produce"
type: string
branch_from_ref:
required: false
description: "Commit to branch from, if not the tag"
type: string
release-notes:
required: true
description: "Release notes to publish"
type: string
jobs:
version-bump:
name: version bump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
token: ${{ secrets.PULUMI_BOT_TOKEN }}
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.0' # decoupled from version sets, only used by changelog tool
- name: Create PR
env:
PULUMI_VERSION: ${{ inputs.version }}
RELEASE_NOTES: ${{ inputs.release-notes }}
GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
run: |
set -euo pipefail
echo -en "# Changelog\n\n${RELEASE_NOTES}\n\n$(tail -n+3 CHANGELOG.md)" > ./CHANGELOG.md
git config user.name github-actions
git config user.email github-actions@github.com
rm -f ./changelog/pending/*.yaml
# Update go module dependencies
(
cd pkg
go get -u "github.com/pulumi/pulumi/sdk/v3@v${PULUMI_VERSION}"
)
make tidy
git add -A
git commit -m "chore: post-release go.mod and changelog updates for v${PULUMI_VERSION}"
# Rebase on the latest upstream commit. We want to make sure to only clear
# the changelog at the latest tag (which we check out originally), but rebase
# here in case a commit has been merged to master. This is to minimize the
# chance of races.
git pull
git rebase origin/master
# Publish pkg module on another tag.
git tag "pkg/v${PULUMI_VERSION}"
git push origin "pkg/v${PULUMI_VERSION}"
git push -u origin HEAD:master