Skip to content

Release

Release #10

Workflow file for this run

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 login-protector
runs-on: ubuntu-22.04
steps:
- name: Checkout main branch
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
- uses: ./.github/actions/aqua
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- 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 login-protector
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/login-protector:${{ inputs.tag }}
target: login-protector
- name: Build and Push tty-exporter
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/tty-exporter:${{ inputs.tag }}
target: tty-exporter
- name: Setup Git Config
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
- name: Generate install.yaml and push tag
shell: bash -xe {0}
run: |
PROTECTOR_IMG=ghcr.io/${{ github.repository }}:${{ inputs.tag }} make build-installer
git checkout config/manager/kustomization.yaml
if ! git diff --exit-code --quiet; then
git add ./dist/install.yaml
git commit -m "Generate install.yaml for login-protector v${{ inputs.tag }}"
git push
fi
git tag -a v${{ inputs.tag }} -m "Release login-protector 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 }} ./dist/install.yaml --clobber