Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.

ci: update GitLab CI template #13

ci: update GitLab CI template

ci: update GitLab CI template #13

Workflow file for this run

# =============================================================================
# GitHub Actions Workflow for @tummycrypt standalone packages
#
# Triggers:
# - Push to main: test only
# - Tag v*: test + publish to npmjs.com + GitHub Packages + GitLab Packages
# - Manual: workflow_dispatch for ad-hoc publish
#
# Required Secrets:
# NPM_TOKEN - npm access token (org-level secret)
# GITLAB_TOKEN - GitLab PAT with api scope (for GitLab registry publish)
# GITLAB_PROJECT_ID - GitLab project ID (for registry URL)
# =============================================================================
name: CI & Publish
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
workflow_dispatch:
inputs:
publish:
description: 'Publish to registries'
required: false
default: 'false'
type: choice
options:
- 'false'
- 'true'
permissions:
contents: read
packages: write
id-token: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: pnpm run test
publish-npm:
needs: test
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
scope: '@tummycrypt'
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-github:
needs: test
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
scope: '@tummycrypt'
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-gitlab:
needs: test
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- name: Publish to GitLab Package Registry
run: |
echo "@tummycrypt:registry=https://gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROJECT_ID }}/packages/npm/" > .npmrc
echo "//gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROJECT_ID }}/packages/npm/:_authToken=${{ secrets.GITLAB_TOKEN }}" >> .npmrc
npm publish --registry="https://gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROJECT_ID }}/packages/npm/"
rm -f .npmrc