name: CI on: push: branches: - master - alpha permissions: id-token: write contents: write jobs: build: runs-on: ubuntu-latest steps: - name: init run: | git config --global user.name "${GITHUB_ACTOR}" git config --global user.email "${GITHUB_ACTOR}@gmail.com" - name: pull-code uses: actions/checkout@v7 - name: install-node uses: actions/setup-node@v7 with: node-version: 24.x cache: 'npm' - name: install-dependencies run: | npm ci --legacy-peer-deps - name: lint run: | npm run lint - name: check builder schema run: | npm run check:schema - name: hook-code run: | npm run sync - name: test run: | npm run test:ci - name: build run: | npm run build - name: dist-tag id: dist-tag run: | # master -> latest,其它分支(alpha 等)-> 分支同名 tag if [ "${GITHUB_REF_NAME}" = "master" ]; then echo "tag=latest" >> "$GITHUB_OUTPUT" else echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" fi - id: publish name: publish uses: JS-DevTools/npm-publish@v4 if: ${{ github.repository_owner == 'wszgrcy' }} with: package: ./dist/package.json tag: ${{ steps.dist-tag.outputs.tag }} provenance: true access: public - if: ${{ github.repository_owner == 'wszgrcy' && steps.publish.outputs.type }} run: | echo "[${{ steps.publish.outputs.type }}]Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }} (dist-tag: ${{ steps.dist-tag.outputs.tag }})" git tag v${{steps.publish.outputs.version}} git push origin v${{steps.publish.outputs.version}}