Files
strapi-plugin-checkbox-list/.github/workflows/publish.yml
Valentin Popov 5cb05bd37e
Some checks failed
RenovateBot / renovate (push) Has been cancelled
Test / Basic (push) Has been cancelled
Merge pull request 'Update actions/checkout action to v6' (!11) from renovate/actions-checkout-6.x into master
Reviewed-on: #11
2026-02-06 04:04:35 +04:00

90 lines
2.5 KiB
YAML

name: Publish
on:
push:
tags:
- "v*"
permissions:
contents: read
id-token: write
jobs:
test:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22
cache: "npm"
cache-dependency-path: |
package-lock.json
playground/package-lock.json
- name: Check tag matches package version
run: |
VERSION=$(node -p "require('./package.json').version")
TAG="${GITHUB_REF_NAME}"
if [ "v${VERSION}" != "${TAG}" ]; then
echo "Tag ${TAG} does not match package.json version v${VERSION}"
exit 1
fi
- name: Write playground .env
run: |
printf '%s' "${{ secrets.PLAYGROUND_ENV_BASE64 }}" | base64 -d > playground/.env
- name: Install root deps
run: npm ci
- name: Build plugin
run: npm run build
- name: Verify plugin
run: npm run verify
- name: Pack plugin into playground .yalc
run: |
TARBALL=$(npm pack --silent)
mkdir -p playground/.yalc/strapi-plugin-checkbox-list
tar -xzf "$TARBALL" -C playground/.yalc/strapi-plugin-checkbox-list --strip-components=1
- name: Install playground deps
working-directory: playground
run: npm install
- name: Build playground
working-directory: playground
run: npm run build
- name: Integration tests
working-directory: playground
run: npm run test:integration
publish:
name: Publish to NPM
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22
cache: "npm"
cache-dependency-path: package-lock.json
- name: Upgrade npm for trusted publishing
run: npm install -g npm@^11.5.1
- name: Check tag matches package version
run: |
VERSION=$(node -p "require('./package.json').version")
TAG="${GITHUB_REF_NAME}"
if [ "v${VERSION}" != "${TAG}" ]; then
echo "Tag ${TAG} does not match package.json version v${VERSION}"
exit 1
fi
- name: Install deps
run: npm ci
- name: Build plugin
run: npm run build
- name: Verify plugin
run: npm run verify
- name: Publish
run: npm publish --provenance