Skip to content

Commit ffc95bc

Browse files
authored
Merge pull request #749 from vdice/ci/fix-736
ci(release.yml): create PR for template SDK updates
2 parents 913686d + 840830a commit ffc95bc

File tree

2 files changed

+40
-28
lines changed

2 files changed

+40
-28
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ jobs:
221221
steps:
222222
- uses: actions/checkout@v2
223223

224-
- name: set the tag sdk/go/v*
224+
- name: Set the tag to sdk/go/v*
225225
shell: bash
226226
run: echo "GO_SDK_TAG=sdk/go/${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
227227

@@ -233,24 +233,18 @@ jobs:
233233
git tag ${{ env.GO_SDK_TAG }}
234234
git push origin ${{ env.GO_SDK_TAG }}
235235
236-
commit-and-create-template-tag:
237-
name: Change sdk version in templates and create a new tag spin/templates/v*
236+
create-template-sdk-update-pr:
237+
name: Create PR with template SDK updates
238238
runs-on: ubuntu-latest
239239
needs: create-go-sdk-tag
240240
if: startsWith(github.ref, 'refs/tags/v')
241241
steps:
242242
- uses: actions/checkout@v2
243243

244-
- name: set the spin tag
244+
- name: Set the spin tag
245245
shell: bash
246246
run: echo "SPIN_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
247247

248-
- name: set the tag spin/templates/v*
249-
shell: bash
250-
run: |
251-
IFS=. read -r major minor patch <<< "${{ env.SPIN_TAG }}"
252-
echo "TEMPLATE_TAG=spin/templates/$major.$minor" >> $GITHUB_ENV
253-
254248
- name: Change sdk version
255249
shell: bash
256250
run: |
@@ -265,19 +259,33 @@ jobs:
265259
git_user_signingkey: true
266260
git_commit_gpgsign: true
267261

268-
- name: Commit changes
269-
uses: stefanzweifel/git-auto-commit-action@v4
262+
- name: Create Pull Request
263+
uses: peter-evans/create-pull-request@v4
270264
with:
271-
commit_message: "feat(templates): update sdk to ${{ env.SPIN_TAG }}"
272-
commit_options: '-s -S'
273-
commit_user_name: fermybot
274-
commit_user_email: 103076628+fermybot@users.noreply.github.com
275-
commit_author: fermybot <103076628+fermybot@users.noreply.github.com>
276-
file_pattern: templates/*
277-
branch: main
278-
skip_dirty_check: true
279-
skip_fetch: true
280-
skip_checkout: true
265+
commit-message: "feat(templates): update sdk to ${{ env.SPIN_TAG }}"
266+
title: "feat(templates): update sdk to ${{ env.SPIN_TAG }}"
267+
body: Update the SDK version used by the templates
268+
branch: update-sdk-${{ env.SPIN_TAG }}
269+
base: main
270+
delete-branch: true
271+
committer: fermybot <103076628+fermybot@users.noreply.github.com>
272+
author: fermybot <103076628+fermybot@users.noreply.github.com>
273+
signoff: true
274+
275+
# This will run when the PR above is approved and merged into main via a merge commit
276+
push-templates-tag:
277+
runs-on: ubuntu-latest
278+
needs: build
279+
if: github.event.commits[0].author.name == 'fermybot' && contains(github.event.commits[0].message, 'update sdk')
280+
steps:
281+
- uses: actions/checkout@v2
282+
283+
- name: Set the tag to spin/templates/v*
284+
shell: bash
285+
run: |
286+
spin_tag=$(echo "${{ github.event.commits[0].message }}" | grep -Eo v[0-9.]+)
287+
IFS=. read -r major minor patch <<< "${spin_tag}"
288+
echo "TEMPLATE_TAG=spin/templates/$major.$minor" >> $GITHUB_ENV
281289
282290
- name: Tag spin/templates/v* and push it
283291
shell: bash

docs/content/release-process.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ To cut a release of Spin, you will need to do the following:
1717
1. Before proceeding, verify that the merge commit on `main` intended to be
1818
tagged is green, i.e. CI is successful
1919
1. Create a new tag with a `v` and then the version number (`v0.5.1`)
20-
1. The Go SDK tag `sdk/go/v0.5.1` and template tag `spin/templates/v0.5` will
21-
be created in the `release`
22-
[action](https://github.com/fermyon/spin/actions/workflows/release.yaml).
23-
1. When the `release`
24-
[action](https://github.com/fermyon/spin/actions/workflows/release.yaml)
25-
completes, binary artifacts and checksums will be automatically uploaded.
20+
1. The Go SDK tag `sdk/go/v0.5.1` will be created in the [release action].
21+
1. When the [release action] completes, binary artifacts and checksums will be
22+
automatically uploaded to the GitHub release.
23+
1. A Pull Request will also be created by `fermybot` containing changes to the
24+
templates per the updated SDK version. Once CI completes, approve this PR and
25+
merge via a merge commit. This will trigger the `push-templates-tag` job in
26+
the [release action], pushing the `spin/templates/v0.5` tag. (Note
27+
that this tag may be force-pushed for all patch releases of a given minor release.)
2628
1. Go to the GitHub [tags page](https://github.com/fermyon/spin/releases),
2729
edit a release, add the release notes.
2830

2931
At this point, you can verify in the GitHub UI that the release was successful.
32+
33+
[release action]: https://github.com/fermyon/spin/actions/workflows/release.yml

0 commit comments

Comments
 (0)