Skip to content

Commit a26c686

Browse files
authored
Merge pull request containerd#10168 from dmcgowan/api-release-action
Add API release action
2 parents b6ffa27 + b811a88 commit a26c686

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/api-release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
on:
2+
push:
3+
tags:
4+
- "api/v*" # Push events to matching api/v*, i.e. api/v1.0, api/v20.15.10
5+
6+
name: API Release
7+
8+
env:
9+
GO_VERSION: "1.22.2"
10+
11+
permissions: # added using https://github.com/step-security/secure-workflows
12+
contents: read
13+
14+
jobs:
15+
check:
16+
name: Check Signed Tag
17+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/api/v')
18+
runs-on: ubuntu-20.04
19+
timeout-minutes: 5
20+
outputs:
21+
stringver: ${{ steps.contentrel.outputs.stringver }}
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.ref }}
28+
path: src/github.com/containerd/containerd
29+
30+
- name: Check signature
31+
run: |
32+
releasever=${{ github.ref }}
33+
releasever="${releasever#refs/tags/}"
34+
TAGCHECK=$(git tag -v ${releasever} 2>&1 >/dev/null) ||
35+
echo "${TAGCHECK}" | grep -q "error" && {
36+
echo "::error::tag ${releasever} is not a signed tag. Failing release process."
37+
exit 1
38+
} || {
39+
echo "Tag ${releasever} is signed."
40+
exit 0
41+
}
42+
working-directory: src/github.com/containerd/containerd
43+
44+
- name: Release content
45+
id: contentrel
46+
run: |
47+
RELEASEVER=${{ github.ref }}
48+
echo "stringver=${RELEASEVER#refs/tags/api/v}" >> $GITHUB_OUTPUT
49+
git tag -l ${RELEASEVER#refs/tags/} -n20000 | tail -n +3 | cut -c 5- >release-notes.md
50+
working-directory: src/github.com/containerd/containerd
51+
52+
- name: Save release notes
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: containerd-release-notes
56+
path: src/github.com/containerd/containerd/release-notes.md
57+
58+
release:
59+
name: Create containerd Release
60+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/api/v')
61+
permissions:
62+
contents: write
63+
runs-on: ubuntu-20.04
64+
timeout-minutes: 10
65+
needs: [check]
66+
steps:
67+
- name: Download release notes
68+
uses: actions/download-artifact@v4
69+
with:
70+
path: builds
71+
- name: Create Release
72+
uses: softprops/action-gh-release@v2
73+
with:
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
fail_on_unmatched_files: true
76+
name: containerd API ${{ needs.check.outputs.stringver }}
77+
draft: false
78+
make_latest: false
79+
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
80+
body_path: ./builds/containerd-release-notes/release-notes.md

0 commit comments

Comments
 (0)