Skip to content

Commit 3f957f8

Browse files
authored
fix(ci): allow workflow_dispatch sync from main branch (#42)
Remove the v*-only restriction on sync_to_doc, map branch builds to the latest release when syncing index.yaml, and reject the outdated latest git tag as a manual ref.
1 parent 05dab6d commit 3f957f8

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
type: string
1515
default: 'main'
1616
sync_to_doc:
17-
description: 'Sync index.yaml to curvine-doc repository (v* tags only)'
17+
description: 'Sync index.yaml to curvine-doc repository after build'
1818
required: true
1919
type: boolean
2020
default: false
@@ -38,8 +38,8 @@ jobs:
3838
REF="main"
3939
fi
4040
41-
if [[ "${{ inputs.sync_to_doc }}" == "true" && "$REF" != v* ]]; then
42-
echo "::error title=Invalid sync target::sync_to_doc=true is only supported for version tags (v*). Received ref: $REF"
41+
if [[ "$REF" == "latest" ]]; then
42+
echo "::error title=Invalid ref::ref=latest is an outdated git tag. Use ref=main to build and sync the testing release."
4343
exit 1
4444
fi
4545
@@ -421,15 +421,23 @@ jobs:
421421
fi
422422
423423
SOURCE_SHA=$(git -C source-repo rev-parse HEAD)
424-
TAG="$SOURCE_REF"
425-
VERSION="${TAG#v}"
424+
425+
# Branch builds publish to the "latest" testing release, not a tag named after the branch.
426+
if [[ "$SOURCE_REF" == v* ]]; then
427+
TAG="$SOURCE_REF"
428+
VERSION="${TAG#v}"
429+
else
430+
TAG="latest"
431+
VERSION="latest"
432+
fi
426433
427434
echo "source_ref=$SOURCE_REF" >> "$GITHUB_OUTPUT"
428435
echo "source_sha=$SOURCE_SHA" >> "$GITHUB_OUTPUT"
429436
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
430437
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
431438
echo "Sync source ref: $SOURCE_REF"
432439
echo "Sync source SHA: $SOURCE_SHA"
440+
echo "Release tag for download: $TAG"
433441
434442
- name: Checkout curvine-doc repository
435443
uses: actions/checkout@v4

0 commit comments

Comments
 (0)