-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate the release process using github actions (#730)
Signed-off-by: Scott Nichols <scott@chainguard.dev>
- Loading branch information
Showing
4 changed files
with
187 additions
and
73 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,105 @@ | ||
name: Release Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- release-* | ||
|
||
jobs: | ||
semver: | ||
name: Calculate Next Release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
next: ${{ steps.ggsv.outputs.next}} | ||
steps: | ||
- name: Setup Go 1.17.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17.x | ||
|
||
- name: Install Dependencies | ||
run: go install tableflip.dev/ggsv@latest | ||
|
||
- name: Look at Ref | ||
id: ggsv | ||
run: | | ||
NEXT=`ggsv next-patch $GITHUB_SERVER_URL/${{ github.repository }}.git ${{ github.ref }}` | ||
echo "::set-output name=next::$NEXT" | ||
mainmodule: | ||
name: Release Main Module | ||
runs-on: ubuntu-latest | ||
needs: semver | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Create Release ${{ needs.semver.outputs.next }} | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ needs.semver.outputs.next }} | ||
release_name: Release ${{ needs.semver.outputs.next }} | ||
prerelease: false | ||
|
||
submodules: | ||
name: Release Sub-Modules | ||
runs-on: ubuntu-latest | ||
needs: | ||
- semver | ||
- mainmodule | ||
env: | ||
VERSION: ${{ needs.semver.outputs.next }} | ||
steps: | ||
- name: Set up Go 1.17.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17.x | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
- run: git pull | ||
|
||
- name: Update Modules | ||
run: | | ||
./hack/tag-release.sh | ||
- name: Commit Repoint | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git diff-index --quiet HEAD || (git commit -a -m "Repoint modules for release ${{ needs.semver.outputs.next }}." --allow-empty && git push) | ||
- name: Tag Modules | ||
run: ./hack/tag-release.sh --tag --push | ||
|
||
examples: | ||
name: Update Examples | ||
runs-on: ubuntu-latest | ||
needs: | ||
- semver | ||
- mainmodule | ||
- submodules | ||
env: | ||
VERSION: ${{ needs.semver.outputs.next }} | ||
steps: | ||
- name: Set up Go 1.17.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17.x | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
- run: git pull | ||
|
||
- name: Update Examples | ||
run: ./hack/tag-release.sh --samples | ||
|
||
- name: Commit Repoint | ||
env: | ||
tag: ${{ matrix.module }}/${{ needs.semver.outputs.next }} | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git diff-index --quiet HEAD || (git commit -a -m "Repoint examples, post release ${{ needs.semver.outputs.next }}." --allow-empty && git push) |
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
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