54 lines
1.8 KiB
YAML
54 lines
1.8 KiB
YAML
name: Release Tag
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions: write-all
|
|
|
|
jobs:
|
|
validate-version:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
valid: ${{ steps.check.outputs.valid }}
|
|
version: ${{ steps.check.outputs.version }}
|
|
steps:
|
|
- name: Validate semantic version
|
|
id: check
|
|
run: |
|
|
TAG="${GITHUB_REF#refs/tags/}"
|
|
echo "Checking tag: $TAG"
|
|
|
|
SEMVER_REGEX="^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?$"
|
|
|
|
if [[ "$TAG" =~ $SEMVER_REGEX ]]; then
|
|
echo "Valid semantic version: $TAG"
|
|
echo "valid=true" >> $GITHUB_OUTPUT
|
|
echo "version=$TAG" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "Invalid version format: $TAG"
|
|
echo "Expected format: vX.Y.Z or vX.Y.Z-prerelease"
|
|
echo "Examples: v1.0.0, v1.2.3-beta, v2.0.0-rc.1"
|
|
echo "valid=false" >> $GITHUB_OUTPUT
|
|
exit 1
|
|
fi
|
|
|
|
trigger-release:
|
|
needs: [validate-version]
|
|
if: needs.validate-version.outputs.valid == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Trigger release-publish workflow
|
|
env:
|
|
GH_TOKEN: ${{ secrets.NAPCAT_BUILD }}
|
|
VERSION: ${{ needs.validate-version.outputs.version }}
|
|
run: |
|
|
echo "Triggering release-publish workflow with version=${VERSION}"
|
|
curl -X POST \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "Authorization: Bearer $GH_TOKEN" \
|
|
https://api.github.com/repos/${{ github.repository }}/actions/workflows/release-publish.yml/dispatches \
|
|
-d "{\"ref\":\"main\",\"inputs\":{\"version\":\"${VERSION}\"}}"
|