-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10168 from dmcgowan/api-release-action
Add API release action
- Loading branch information
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
on: | ||
push: | ||
tags: | ||
- "api/v*" # Push events to matching api/v*, i.e. api/v1.0, api/v20.15.10 | ||
|
||
name: API Release | ||
|
||
env: | ||
GO_VERSION: "1.22.2" | ||
|
||
permissions: # added using https://github.com/step-security/secure-workflows | ||
contents: read | ||
|
||
jobs: | ||
check: | ||
name: Check Signed Tag | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/api/v') | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 5 | ||
outputs: | ||
stringver: ${{ steps.contentrel.outputs.stringver }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref }} | ||
path: src/github.com/containerd/containerd | ||
|
||
- name: Check signature | ||
run: | | ||
releasever=${{ github.ref }} | ||
releasever="${releasever#refs/tags/}" | ||
TAGCHECK=$(git tag -v ${releasever} 2>&1 >/dev/null) || | ||
echo "${TAGCHECK}" | grep -q "error" && { | ||
echo "::error::tag ${releasever} is not a signed tag. Failing release process." | ||
exit 1 | ||
} || { | ||
echo "Tag ${releasever} is signed." | ||
exit 0 | ||
} | ||
working-directory: src/github.com/containerd/containerd | ||
|
||
- name: Release content | ||
id: contentrel | ||
run: | | ||
RELEASEVER=${{ github.ref }} | ||
echo "stringver=${RELEASEVER#refs/tags/api/v}" >> $GITHUB_OUTPUT | ||
git tag -l ${RELEASEVER#refs/tags/} -n20000 | tail -n +3 | cut -c 5- >release-notes.md | ||
working-directory: src/github.com/containerd/containerd | ||
|
||
- name: Save release notes | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: containerd-release-notes | ||
path: src/github.com/containerd/containerd/release-notes.md | ||
|
||
release: | ||
name: Create containerd Release | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/api/v') | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 10 | ||
needs: [check] | ||
steps: | ||
- name: Download release notes | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: builds | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fail_on_unmatched_files: true | ||
name: containerd API ${{ needs.check.outputs.stringver }} | ||
draft: false | ||
make_latest: false | ||
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }} | ||
body_path: ./builds/containerd-release-notes/release-notes.md |