Skip to content

Commit 512d0f2

Browse files
committed
feat: Mirror release manually
1 parent 1d9e42c commit 512d0f2

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to mirror (e.g. v1.2.3)'
11+
required: true
12+
default: ${GITHUB_REF_NAME}
713

814
permissions:
915
contents: write
@@ -15,17 +21,17 @@ jobs:
1521
GITLAB_PROJECT: uniget-org/cli
1622
GITLAB_PROJECT_API: uniget-org%2Fcli
1723
GITLAB_REPO_URL: https://gitlab.com/${GITLAB_PROJECT}
18-
GITLAB_RELEASE_API_URL: https://gitlab.com/${GITLAB_PROJECT}/-/releases/${GITHUB_REF_NAME}
19-
GITLAB_PROJECT_API_URL: "https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_API}/releases/${GITHUB_REF_NAME}"
24+
GITLAB_RELEASE_API_URL: https://gitlab.com/${GITLAB_PROJECT}/-/releases/${{ inputs.tag }}
25+
GITLAB_PROJECT_API_URL: "https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_API}/releases/${{ inputs.tag }}"
2026
steps:
2127
- name: Mirror release from GitLab
2228
shell: bash
2329
run: |
2430
set -euo pipefail
2531
26-
echo "Fetching GitLab release for tag: ${GITHUB_REF_NAME}"
32+
echo "Fetching GitLab release for tag: ${{ inputs.tag }}"
2733
if ! curl --silent --show-error --location --fail --output release.json "${GITLAB_PROJECT_API_URL}"; then
28-
echo "ERROR: Failed to fetch GitLab release for tag >${GITHUB_REF_NAME}>."
34+
echo "ERROR: Failed to fetch GitLab release for tag >${{ inputs.tag }}>."
2935
exit 1
3036
fi
3137
@@ -37,10 +43,10 @@ jobs:
3743
jq -r '.description // ""' release.json
3844
} >"${notes_file}"
3945
40-
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
41-
echo "Updating existing GitHub release ${GITHUB_REF_NAME}"
42-
gh release edit "${GITHUB_REF_NAME}" --title "${title}" --notes-file "${notes_file}"
46+
if gh release view "${{ inputs.tag }}" >/dev/null 2>&1; then
47+
echo "Updating existing GitHub release ${{ inputs.tag }}"
48+
gh release edit "${{ inputs.tag }}" --title "${title}" --notes-file "${notes_file}"
4349
else
44-
echo "Creating GitHub release ${GITHUB_REF_NAME}"
45-
gh release create "${GITHUB_REF_NAME}" --title "${title}" --notes-file "${notes_file}"
50+
echo "Creating GitHub release ${{ inputs.tag }}"
51+
gh release create "${{ inputs.tag }}" --title "${title}" --notes-file "${notes_file}"
4652
fi

0 commit comments

Comments
 (0)