ci(release): add workflow_dispatch input for manual release tagging
Some checks failed
CI / build-and-test (push) Failing after -30m40s
Some checks failed
CI / build-and-test (push) Failing after -30m40s
This commit is contained in:
@@ -4,6 +4,11 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*.*.*'
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: 'Tag to release (e.g. v1.2.3)'
|
||||||
|
required: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITEA_SERVER: https://git.warky.dev
|
GITEA_SERVER: https://git.warky.dev
|
||||||
@@ -38,7 +43,8 @@ jobs:
|
|||||||
- name: Set build vars
|
- name: Set build vars
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
|
TAG="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
|
echo "VERSION=${TAG}" >> $GITHUB_OUTPUT
|
||||||
echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
echo "BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
|
echo "BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
@@ -66,21 +72,21 @@ jobs:
|
|||||||
- name: Create Gitea Release
|
- name: Create Gitea Release
|
||||||
id: create_release
|
id: create_release
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ steps.vars.outputs.VERSION }}"
|
export VERSION="${{ steps.vars.outputs.VERSION }}"
|
||||||
BODY=$(python3 <<'PY'
|
BODY=$(python3 <<'PY'
|
||||||
import json, subprocess, os
|
import json, subprocess, os
|
||||||
version = os.environ['VERSION']
|
version = os.environ['VERSION']
|
||||||
commit = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'], text=True).strip()
|
commit = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'], text=True).strip()
|
||||||
body = f"## {version}\n\nBuilt from commit {commit}.\n\nSee `checksums.txt` to verify downloads."
|
body = f"## {version}\n\nBuilt from commit {commit}.\n\nSee `checksums.txt` to verify downloads."
|
||||||
print(json.dumps({
|
print(json.dumps({
|
||||||
'tag_name': version,
|
'tag_name': version,
|
||||||
'name': version,
|
'name': version,
|
||||||
'body': body,
|
'body': body,
|
||||||
'draft': False,
|
'draft': False,
|
||||||
'prerelease': False,
|
'prerelease': False,
|
||||||
}))
|
}))
|
||||||
PY
|
PY
|
||||||
)
|
)
|
||||||
RESPONSE=$(curl -fsS -X POST "${{ env.GITEA_SERVER }}/api/v1/repos/${{ env.GITEA_REPO }}/releases" \
|
RESPONSE=$(curl -fsS -X POST "${{ env.GITEA_SERVER }}/api/v1/repos/${{ env.GITEA_REPO }}/releases" \
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
|
|||||||
Reference in New Issue
Block a user