Skip to content

Commit d8e15e0

Browse files
authored
Merge pull request #685 from FrankYang0529/auto-create-sdk-and-template-tag
feat(ci): create sdk and template tag in release action
2 parents 1620b09 + 8b1eca5 commit d8e15e0

File tree

2 files changed

+75
-17
lines changed

2 files changed

+75
-17
lines changed

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,77 @@ jobs:
212212
body: |
213213
This is a "canary" release of the most recent commits on our main branch. Canary is **not stable**.
214214
It is only intended for developers wishing to try out the latest features in Spin, some of which may not be fully implemented.
215+
216+
create-go-sdk-tag:
217+
name: create tag sdk/go/v*
218+
runs-on: ubuntu-latest
219+
needs: build
220+
if: startsWith(github.ref, 'refs/tags/v')
221+
steps:
222+
- uses: actions/checkout@v2
223+
224+
- name: set the tag sdk/go/v*
225+
shell: bash
226+
run: echo "GO_SDK_TAG=sdk/go/${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
227+
228+
- name: Tag sdk/go/v* and push it
229+
shell: bash
230+
env:
231+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
232+
run: |
233+
git tag ${{ env.GO_SDK_TAG }}
234+
git push origin ${{ env.GO_SDK_TAG }}
235+
236+
commit-and-create-template-tag:
237+
name: Change sdk version in templates and create a new tag spin/templates/v*
238+
runs-on: ubuntu-latest
239+
needs: create-go-sdk-tag
240+
if: startsWith(github.ref, 'refs/tags/v')
241+
steps:
242+
- uses: actions/checkout@v2
243+
244+
- name: set the spin tag
245+
shell: bash
246+
run: echo "SPIN_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
247+
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+
254+
- name: Change sdk version
255+
shell: bash
256+
run: |
257+
cd templates
258+
SDK_VERSION=${{ env.SPIN_TAG }} make
259+
260+
- name: Import GPG key
261+
uses: crazy-max/ghaction-import-gpg@v5
262+
with:
263+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
264+
passphrase: ${{ secrets.PASSPHRASE }}
265+
git_user_signingkey: true
266+
git_commit_gpgsign: true
267+
268+
- name: Commit changes
269+
uses: stefanzweifel/git-auto-commit-action@v4
270+
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
281+
282+
- name: Tag spin/templates/v* and push it
283+
shell: bash
284+
env:
285+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
286+
run: |
287+
git tag ${{ env.TEMPLATE_TAG }} -f
288+
git push origin ${{ env.TEMPLATE_TAG }} -f

docs/content/release-process.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,7 @@ 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.3.1`)
20-
1. Create a tag for the Go SDK on the same commit as above, e.g.
21-
`sdk/go/v0.3.1`
22-
1. Push the tags to origin on GitHub
23-
- The `v0.3.1` tag push will trigger a
24-
[release build](https://github.com/fermyon/spin/actions/workflows/release.yml)
25-
1. While waiting for the release, bump the version for the project templates
26-
under the `templates` directory via the `make` target:
27-
```console
28-
cd templates
29-
SDK_VERSION=v0.3.1 make
30-
```
31-
- Create a follow-up PR with the updated files
32-
1. Async step: After the follow-up PR from the previous step is merged, create
33-
a tag for the templates at the merge commit. Tag should be named e.g.
34-
`spin/templates/v0.3`
35-
- Note the `v0.3` - the tag only needs to be created on minor releases and
36-
this step should be skipped on patch releases.
20+
1. The Go SDK tag `sdk/go/v0.3.1` and template tag `spin/templates/v0.3` will be created in `release` [action](https://github.com/fermyon/spin/actions/workflows/release.yaml).
3721
1. When the `release`
3822
[action](https://github.com/fermyon/spin/actions/workflows/release.yaml)
3923
completes, binary artifacts and checksums will be automatically uploaded.

0 commit comments

Comments
 (0)