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

93 lines
2.6 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
next-version:
required: true
description: "Version to bump files to"
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
jobs:
version-bump:
name: Version Bump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Create PR
env:
PULUMI_VERSION: ${{ inputs.version }}
NEXT_VERSION: ${{ inputs.next-version }}
RELEASE_NOTES: ${{ inputs.release-notes }}
QUEUE_MERGE: ${{ inputs.queue-merge }}
GITHUB_TOKEN: ${{ secrets.MERGE_PR_TOKEN }}
run: |
set -euo pipefail
git switch --create "automation/release-v${PULUMI_VERSION}-v${NEXT_VERSION}"
echo -en "# Changelog\n\n${RELEASE_NOTES}\n\n$(tail -n+3 CHANGELOG.md)" > ./CHANGELOG.md
./.github/scripts/update-versions "${NEXT_VERSION}"
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 "prepare for next release (v${NEXT_VERSION})"
# TODO: bump go module dependencies in pkg, test, etc.
# Update go module dependencies
# pushd ./pkg/test
# go get -u "github.com/aaronfriel/go-change@v${PULUMI_VERSION}"
# go mod tidy
# git add go.mod go.sum
# popd
# git commit -m "Update dependencies"
# Publish Go module on another tag
git tag "pkg/test/v${PULUMI_VERSION}"
git push origin "pkg/test/v${PULUMI_VERSION}"
git push -u origin HEAD
PR_BODY=""
if [ "${QUEUE_MERGE}" = "true" ]; then
PR_BODY="bors r+"
fi
gh pr create \
--title "prepare for next release (v${NEXT_VERSION})" \
--body "${PR_BODY}"