Release #5
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: | |
workflow_dispatch: | |
inputs: | |
tag: | |
type: string | |
required: true | |
description: The name of the tag to release (X.Y.Z) | |
jobs: | |
release: | |
name: Release network-policy-viewer | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Validate inputs | |
run: | | |
if [[ ! ${{ inputs.tag }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Invalid tag format. Please use X.Y.Z" | |
exit 1 | |
fi | |
if git rev-parse v${{ inputs.tag }} >/dev/null 2>&1; then | |
echo "Tag v${{ inputs.tag }} already exists" | |
exit 1 | |
fi | |
- name: Download Cilium CLI | |
run: make download-cilium-cli | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push cilium-agent-proxy | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ghcr.io/cybozu-go/cilium-agent-proxy:${{ inputs.tag }} | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Build | |
run: | | |
make build | |
cd bin; tar -czvf npv_v${{ inputs.tag }}_amd64.tar.gz npv | |
- name: Setup Git Config | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
- name: Push tag | |
run: | | |
git tag -a v${{ inputs.tag }} -m "Release network-policy-viewer v${{ inputs.tag }}" | |
git push origin v${{ inputs.tag }} | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create v${{ inputs.tag }} --title "Release v${{ inputs.tag }}" --generate-notes | |
gh release upload v${{ inputs.tag }} bin/npv_v${{ inputs.tag }}_amd64.tar.gz --clobber |