fix(ci): use POSIX-compatible case statement for tag detection
All checks were successful
Build & Publish / publish (push) Successful in 44s
All checks were successful
Build & Publish / publish (push) Successful in 44s
The Gitea runner uses sh, not bash — [[ ]] syntax fails silently causing all pushes to publish as snapshots instead of tagged releases. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,17 +23,21 @@ jobs:
|
|||||||
run: npm run build:lib
|
run: npm run build:lib
|
||||||
|
|
||||||
- name: Publish package
|
- name: Publish package
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
case "$GITHUB_REF" in
|
||||||
VERSION="${GITHUB_REF_NAME#v}"
|
refs/tags/v*)
|
||||||
npm version "$VERSION" --no-git-tag-version
|
VERSION="${GITHUB_REF_NAME#v}"
|
||||||
TAG="latest"
|
npm version "$VERSION" --no-git-tag-version
|
||||||
else
|
TAG="latest"
|
||||||
SHORT_SHA=$(echo "$GITHUB_SHA" | head -c 7)
|
;;
|
||||||
DATE=$(date +%Y%m%d)
|
*)
|
||||||
npm version "0.0.0-snapshot.${DATE}.${SHORT_SHA}" --no-git-tag-version
|
SHORT_SHA=$(echo "$GITHUB_SHA" | head -c 7)
|
||||||
TAG="dev"
|
DATE=$(date +%Y%m%d)
|
||||||
fi
|
npm version "0.0.0-snapshot.${DATE}.${SHORT_SHA}" --no-git-tag-version
|
||||||
|
TAG="dev"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
echo '@cameleer:registry=https://gitea.siegeln.net/api/packages/cameleer/npm/' > .npmrc
|
echo '@cameleer:registry=https://gitea.siegeln.net/api/packages/cameleer/npm/' > .npmrc
|
||||||
echo '//gitea.siegeln.net/api/packages/cameleer/npm/:_authToken=${{ secrets.REGISTRY_TOKEN }}' >> .npmrc
|
echo '//gitea.siegeln.net/api/packages/cameleer/npm/:_authToken=${{ secrets.REGISTRY_TOKEN }}' >> .npmrc
|
||||||
npm publish --tag "$TAG"
|
npm publish --tag "$TAG"
|
||||||
|
|||||||
Reference in New Issue
Block a user