diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index df73a06..ebce249 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,24 +1,33 @@ -# CI for @punktfunk/plugin-rom-manager (Gitea Actions). Installs resolve `@punktfunk/*` and `@unom/*` -# (the SPA's design system) from the Gitea npm registry via the bunfig scope maps; `effect` comes from -# npm. The GITEA_NPM_TOKEN secret authenticates registry reads. Publish runs on a `v*` tag. +# CI for @punktfunk/plugin-rom-manager (Gitea Actions). Mirrors the main repo's sdk-publish.yml: +# ubuntu-24.04 runner + the oven/bun:1 container, auth via the shared REGISTRY_TOKEN secret. +# Installs resolve @punktfunk/* + @unom/* (the SPA's design system) from the Gitea registry via the +# bunfig scope maps; `effect` comes from npm. Publish runs on a `v*` tag. name: CI on: push: branches: [main] - tags: ["v*"] + tags: ['v*'] pull_request: + workflow_dispatch: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + container: + image: oven/bun:1 + timeout-minutes: 15 steps: + # oven/bun's slim base ships neither git nor a CA bundle — actions/checkout's HTTPS fetch needs both. + - name: Install git + CA certs + run: apt-get update && apt-get install -y --no-install-recommends ca-certificates git nodejs - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest - name: Registry auth - run: echo "//git.unom.io/api/packages/unom/npm/:_authToken=${{ secrets.GITEA_NPM_TOKEN }}" > ~/.npmrc + env: + TOKEN: ${{ secrets.REGISTRY_TOKEN }} + run: | + test -n "$TOKEN" || { echo "REGISTRY_TOKEN secret is empty"; exit 1; } + printf '//git.unom.io/api/packages/unom/npm/:_authToken=%s\n' "$TOKEN" > "$HOME/.npmrc" - name: Install run: bun install --frozen-lockfile - name: Lint & format @@ -39,17 +48,26 @@ jobs: publish: needs: build if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + container: + image: oven/bun:1 + timeout-minutes: 15 steps: + - name: Install git + CA certs + run: apt-get update && apt-get install -y --no-install-recommends ca-certificates git nodejs - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest - name: Registry auth - run: echo "//git.unom.io/api/packages/unom/npm/:_authToken=${{ secrets.GITEA_NPM_TOKEN }}" > ~/.npmrc + env: + TOKEN: ${{ secrets.REGISTRY_TOKEN }} + run: | + test -n "$TOKEN" || { echo "REGISTRY_TOKEN secret is empty"; exit 1; } + printf '//git.unom.io/api/packages/unom/npm/:_authToken=%s\n' "$TOKEN" > "$HOME/.npmrc" - name: Install run: bun install --frozen-lockfile - - name: Build (backend + SPA) - run: bun run build:all - - name: Publish to the Gitea npm registry - run: npm publish --registry https://git.unom.io/api/packages/unom/npm/ + - name: Tag matches package version + run: | + TAG="${GITHUB_REF_NAME#v}" + PKG="$(node -p "require('./package.json').version")" + test "$TAG" = "$PKG" || { echo "tag $GITHUB_REF_NAME != package version $PKG"; exit 1; } + - name: Publish (prepublishOnly builds backend + SPA) + run: bun publish