Skip to content

Merge pull request #118 from cybozu-go/fix-release-ci #38

Merge pull request #118 from cybozu-go/fix-release-ci

Merge pull request #118 from cybozu-go/fix-release-ci #38

Workflow file for this run

name: release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Release
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: setup
run: make setup
- name: Build binaries
run: make install GOBIN=`pwd`/docker
- name: Build setup-hw image
run: |
docker build -t ghcr.io/cybozu-go/setup-hw:latest --target stage1 docker
docker build -t ghcr.io/cybozu-go/setup-hw-secret:latest docker
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images
run: |
tag=${GITHUB_REF#refs/tags/v}
for name in setup-hw setup-hw-secret; do
echo "pushing ${name}:v${tag} ..."
docker tag ghcr.io/cybozu-go/${name}:latest ghcr.io/cybozu-go/${name}:$tag
if ! echo $tag | grep -q -e '-'; then docker push ghcr.io/cybozu-go/${name}:latest; fi
docker push ghcr.io/cybozu-go/${name}:$tag
done
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tagname="${GITHUB_REF#refs/tags/}"
if echo ${{ github.ref }} | grep -q -e '-'; then prerelease=-p; fi
gh release create -t "Release $tagname" $prerelease \
-n "See [CHANGELOG.md](./CHANGELOG.md) for details." \
"$tagname"