mirror of
https://github.com/pratikwayal01/datacloak.git
synced 2026-10-26 06:59:34 +01:00
123 lines
4.1 KiB
YAML
123 lines
4.1 KiB
YAML
name: publish
|
|
|
|
# Manual release train: dispatch with tag vX.Y.Z -> workflow creates the tag,
|
|
# publishes all four packages at that version, uploads the extension zip,
|
|
# creates the release shell. Author writes release notes manually afterwards.
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Release tag (vX.Y.Z) — must match package + manifest versions'
|
|
required: true
|
|
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
|
|
env:
|
|
TAG: ${{ inputs.tag }}
|
|
|
|
jobs:
|
|
tag:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: master
|
|
- name: validate tag and versions
|
|
run: |
|
|
echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$' || { echo "tag must be vX.Y.Z, got $TAG"; exit 1; }
|
|
git fetch origin "refs/tags/$TAG" && { echo "tag $TAG already exists"; exit 1; } || true
|
|
for p in packages/detect packages/cli packages/opencode-plugin packages/ner; do
|
|
PKG="v$(node -p "require('./$p/package.json').version")"
|
|
test "$TAG" = "$PKG" || { echo "tag $TAG != $p@$PKG"; exit 1; }
|
|
done
|
|
MANIFEST="v$(node -p "require('./packages/browser-extension/manifest.json').version")"
|
|
test "$TAG" = "$MANIFEST" || { echo "tag $TAG != manifest@$MANIFEST"; exit 1; }
|
|
- name: create and push tag
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git tag "$TAG"
|
|
git push origin "$TAG"
|
|
|
|
publish:
|
|
needs: tag
|
|
strategy:
|
|
matrix:
|
|
workspace:
|
|
- packages/detect
|
|
- packages/cli
|
|
- packages/opencode-plugin
|
|
- packages/ner
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.tag }}
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
registry-url: https://registry.npmjs.org
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run build --workspace packages/detect
|
|
- run: npm run build --workspace ${{ matrix.workspace }}
|
|
- run: npm test --workspace ${{ matrix.workspace }}
|
|
- name: publish to npm
|
|
run: npm publish --workspace ${{ matrix.workspace }} --access public --provenance
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
extension-asset:
|
|
needs: publish
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.tag }}
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm test --workspace packages/browser-extension
|
|
- run: npm run package --workspace packages/browser-extension
|
|
- name: upload extension zip to release
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
ZIP="packages/browser-extension/datacloak-extension-${TAG#v}.zip"
|
|
gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --title "$TAG" --generate-notes
|
|
gh release upload "$TAG" "$ZIP" --clobber
|
|
|
|
amo-submit:
|
|
needs: extension-asset
|
|
# Skipped until AMO API creds exist (repo Settings → Secrets → Actions).
|
|
if: ${{ secrets.AMO_JWT_ISSUER != '' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.tag }}
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run build --workspace packages/browser-extension
|
|
- name: submit to Firefox (AMO) for review
|
|
working-directory: packages/browser-extension
|
|
env:
|
|
AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }}
|
|
AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }}
|
|
run: |
|
|
npx -y web-ext sign \
|
|
--source-dir . \
|
|
--channel listed \
|
|
--api-key "$AMO_JWT_ISSUER" \
|
|
--api-secret "$AMO_JWT_SECRET" \
|
|
--approval-timeout 0 \
|
|
--timeout 600000 \
|
|
--ignore-files 'datacloak-extension-*.zip' 'test' 'package.json' 'tsconfig.json' 'vitest.config.ts'
|