Skip to content

build: migrate from changesets to semantic-release (#12) #11

build: migrate from changesets to semantic-release (#12)

build: migrate from changesets to semantic-release (#12) #11

Workflow file for this run

name: Release
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
package:
- name: "@nicepkg/vsync"
dir: "cli"
copyReadme: "true"
# add new packages here
# - name: "@nicepkg/vsync-core"
# dir: "core"
# copyReadme: "false"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-pnpm
- name: Check package exists
id: package-check
shell: bash
run: |
if [ -f "${{ matrix.package.dir }}/package.json" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Copy README files into package
if: steps.package-check.outputs.exists == 'true' && matrix.package.copyReadme == 'true'
shell: bash
run: |
cp README.md "${{ matrix.package.dir }}/README.md"
cp README_cn.md "${{ matrix.package.dir }}/README_cn.md"
- name: Build package
if: steps.package-check.outputs.exists == 'true'
run: pnpm --filter ${{ matrix.package.name }} build
- name: Run semantic-release
if: steps.package-check.outputs.exists == 'true'
run: pnpm run semantic-release
env:
SEMREL_PKG_ROOT: ${{ matrix.package.dir }}
SEMREL_PKG_NAME: ${{ matrix.package.name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
HUSKY: 0