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

82 lines
2.3 KiB
YAML
Raw Permalink Normal View History

2022-09-02 05:40:13 +00:00
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
queue-merge:
required: false
default: false
description: "Whether to queue the release for immediate merge"
type: boolean
2022-09-02 05:40:13 +00:00
jobs:
version-bump:
name: version bump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2022-09-02 05:40:13 +00:00
with:
ref: ${{ inputs.ref }}
- uses: actions/setup-go@v5
2022-09-02 05:40:13 +00:00
with:
go-version: '>=1.19.0' # decoupled from version sets, only used by changelog tool
2022-09-02 05:40:13 +00:00
- name: Create PR
env:
PULUMI_VERSION: ${{ inputs.version }}
RELEASE_NOTES: ${{ inputs.release-notes }}
QUEUE_MERGE: ${{ inputs.queue-merge }}
2022-09-02 05:40:13 +00:00
GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
run: |
set -euo pipefail
git switch --create "automation/release-v${PULUMI_VERSION}"
2022-09-02 05:40:13 +00:00
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 ./changelog/pending/*.yaml || true
git add -A
git commit -m "chore: changelog for v${PULUMI_VERSION}"
2022-09-02 05:40:13 +00:00
# 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 updates"
git push -u origin HEAD
push post-release changelog and go.mod updates straight to master (#15515) Post release, we need to update the changelog (clear out all the pending entries), and update the go.mod in pkg, and also tag the latest version of that. Currently we create a new PR for that. However since we are using squash merges, and need to do the tagging while creating the PR, we're tagging a commit that doesn't end up on the main branch. This means the Go tooling doesn't work properly with pkg. See also https://github.com/pulumi/pulumi/issues/15458. There is nothing really we are doing with that PR other than merging it (in fact queue-merge is set to true, so it should be queued and merged automatically, but that doesn't seem to work). Because of that, we can just tag the release, and push it straight to the main branch instead. This removes one human step from the release process and makes the Go tooling work correctly. The only potential downsides of this change are: - a small race condition, if a commit gets merged just before we do the rebase we might end up failing that and the release workflow fails. This is very unlikely, since the release process should be relatively quick. - we need to adjust the branch protection rules for pulumi-bot so it's able to push to the main branch directly. This should not be a problem, since it's an automated tool, so all of its potential activity has been reviewed by humans beforehand. Curious especially if @justinvp has any thoughts on this, since he's mostly taking care of the release process. Fixes https://github.com/pulumi/pulumi/issues/15458
2024-02-27 15:41:35 +00:00
# Note that the title of the PR is used in the on-push workflow. If the title needs to
# change here, please also check on-push.yml
PR=$(gh pr create --title "Changelog and go.mod updates for v${PULUMI_VERSION}" --body "")
2022-09-02 05:40:13 +00:00
if [ "${QUEUE_MERGE}" = "true" ]; then
gh pr merge --auto --squash "${PR}"
fi