fix: continue-on-error for mirror steps; guard duplicate Forgejo release creation
Some checks failed
CI / test (pull_request) Has been cancelled
Some checks failed
CI / test (pull_request) Has been cancelled
This commit is contained in:
parent
3050179b2f
commit
874354f235
2 changed files with 20 additions and 7 deletions
|
|
@ -15,6 +15,7 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Mirror to GitHub
|
- name: Mirror to GitHub
|
||||||
|
continue-on-error: true
|
||||||
env:
|
env:
|
||||||
GITHUB_MIRROR_TOKEN: ${{ secrets.GITHUB_MIRROR_TOKEN }}
|
GITHUB_MIRROR_TOKEN: ${{ secrets.GITHUB_MIRROR_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -22,6 +23,7 @@ jobs:
|
||||||
git push github --mirror
|
git push github --mirror
|
||||||
|
|
||||||
- name: Mirror to Codeberg
|
- name: Mirror to Codeberg
|
||||||
|
continue-on-error: true
|
||||||
env:
|
env:
|
||||||
CODEBERG_MIRROR_TOKEN: ${{ secrets.CODEBERG_MIRROR_TOKEN }}
|
CODEBERG_MIRROR_TOKEN: ${{ secrets.CODEBERG_MIRROR_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,21 @@ jobs:
|
||||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_RELEASE_TOKEN }}
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_RELEASE_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
TAG="${GITHUB_REF_NAME}"
|
TAG="${GITHUB_REF_NAME}"
|
||||||
jq -n --arg tag "${TAG}" \
|
# Check if release already exists for this tag
|
||||||
'{"tag_name":$tag,"name":$tag,"draft":false,"prerelease":false}' \
|
EXISTING=$(curl -sf \
|
||||||
| curl -sf -X POST \
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
"https://git.opensourcesolarpunk.com/api/v1/repos/Circuit-Forge/circuitforge-core/releases/tags/${TAG}" \
|
||||||
-H "Content-Type: application/json" \
|
2>/dev/null | jq -r '.id // empty')
|
||||||
"https://git.opensourcesolarpunk.com/api/v1/repos/Circuit-Forge/circuitforge-core/releases" \
|
|
||||||
-d @-
|
if [ -z "${EXISTING}" ]; then
|
||||||
|
jq -n --arg tag "${TAG}" \
|
||||||
|
'{"tag_name":$tag,"name":$tag,"draft":false,"prerelease":false}' \
|
||||||
|
| curl -sf -X POST \
|
||||||
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"https://git.opensourcesolarpunk.com/api/v1/repos/Circuit-Forge/circuitforge-core/releases" \
|
||||||
|
-d @-
|
||||||
|
echo "Release created for ${TAG}"
|
||||||
|
else
|
||||||
|
echo "Release for ${TAG} already exists (id=${EXISTING}), skipping."
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue