From d1e5499688bf28c94a2a75e4e09d85b24ad6d1e0 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Wed, 18 Mar 2026 20:32:28 +0100 Subject: [PATCH] ci: add Gitea Actions workflow for npm publishing Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitea/workflows/publish.yml | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .gitea/workflows/publish.yml diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..0224214 --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,39 @@ +name: Build & Publish + +on: + push: + branches: [main] + tags: ['v*'] + +jobs: + publish: + runs-on: linux-arm64 + container: + image: node:22-bookworm-slim + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npx vitest run + + - name: Build library + run: npm run build:lib + + - name: Publish package + run: | + if [[ "$GITHUB_REF" == refs/tags/v* ]]; then + VERSION="${GITHUB_REF_NAME#v}" + npm version "$VERSION" --no-git-tag-version + TAG="latest" + else + 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 + TAG="dev" + fi + 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 + npm publish --tag "$TAG"