name: release # Tag a version (git tag v8.0.0 && git push --tags) and this publishes # every workspace package to the uhhm npm registry on this Gitea, plus # the single-file CDN bundle as a generic package. # # Repo secrets needed (Settings → Actions → Secrets): # PACKAGES_TOKEN — a Gitea access token with package:write scope on: push: tags: ['v*'] jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 24 - run: npm install - run: npm test - name: point npm at the uhhm registry run: | echo "@uhhm:registry=https://project.uhhm.no/api/packages/uhhm/npm/" >> "$HOME/.npmrc" echo "//project.uhhm.no/api/packages/uhhm/npm/:_authToken=${{ secrets.PACKAGES_TOKEN }}" >> "$HOME/.npmrc" - name: publish workspaces run: npm publish --workspaces - name: build + upload the CDN bundle (generic package) run: | npm run bundle VERSION="${GITHUB_REF_NAME#v}" curl --fail -X PUT \ -H "Authorization: token ${{ secrets.PACKAGES_TOKEN }}" \ --upload-file dist-cdn/buuh.js \ "https://project.uhhm.no/api/packages/uhhm/generic/buuh-cdn/${VERSION}/buuh.js" curl --fail -X PUT \ -H "Authorization: token ${{ secrets.PACKAGES_TOKEN }}" \ --upload-file dist-cdn/buuh.js.map \ "https://project.uhhm.no/api/packages/uhhm/generic/buuh-cdn/${VERSION}/buuh.js.map" - name: publish to cdn.uhhm.no (git-pages, incremental) run: | VERSION="${GITHUB_REF_NAME#v}" mkdir cdn cp dist-cdn/buuh.js "cdn/buuh@${VERSION}.js" cp dist-cdn/buuh.js.map "cdn/buuh@${VERSION}.js.map" cp dist-cdn/buuh.js cdn/buuh.js cp dist-cdn/buuh.js.map cdn/buuh.js.map tar -czf cdn.tar.gz -C cdn . # PATCH = incremental: earlier versions stay published forever curl --fail -sS -X PATCH "https://cdn.uhhm.no/" \ -H "Content-Type: application/x-tar+gzip" \ -H "Forge-Authorization: token ${{ secrets.GITEA_TOKEN }}" \ --data-binary @cdn.tar.gz \ -w "cdn: %{http_code}\n"