Merge pull request #289 from cybozu-go/bump-3.1.4 #22
Workflow file for this run
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
name: release | |
on: | |
push: | |
tags: | |
- 'v*' | |
env: | |
tag: ${GITHUB_REF#refs/tags/v} | |
prerelease: ${{ contains(github.ref, '-') }} | |
jobs: | |
release-image: | |
name: Release Sabakan Image | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Build image | |
run: make docker-build | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push container image | |
run: | | |
echo "pushing Sabakan image ..." | |
docker tag ghcr.io/cybozu-go/sabakan:latest ghcr.io/cybozu-go/sabakan:${{ env.tag }} | |
docker push ghcr.io/cybozu-go/sabakan:${{ env.tag }} | |
if ${{ env.prerelease }} ; then | |
echo ===== Skip pushing branch tags for pre-release ${{ env.tag }} ===== | |
exit 0 | |
fi | |
BRANCH=$(echo ${{ env.tag }} | cut -d "." -f 1-2) | |
docker tag ghcr.io/cybozu-go/sabakan:latest ghcr.io/cybozu-go/sabakan:$BRANCH | |
docker push ghcr.io/cybozu-go/sabakan:$BRANCH | |
release-github: | |
name: Release GitHub | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create GitHub release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
VERSION=v${{ env.tag }} | |
if ${{ env.prerelease }}; then PRERELEASE_FLAG=-p; fi | |
gh release create $VERSION $PRERELEASE_FLAG \ | |
-t "Release $VERSION" \ | |
-n "See [CHANGELOG.md](./CHANGELOG.md) for details." |