|
7 | 7 | workflow_dispatch: |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - check: |
11 | | - name: ✅ Check version |
12 | | - outputs: |
13 | | - changed: ${{ steps.check.outputs.changed }} |
14 | | - version: ${{ steps.check.outputs.version }} |
15 | | - runs-on: ubuntu-latest |
16 | | - steps: |
17 | | - - name: ⬇️ Checkout code |
18 | | - uses: actions/checkout@v4 |
19 | | - |
20 | | - - id: check |
21 | | - uses: EndBug/version-check@v2 |
22 | | - with: |
23 | | - diff-search: true |
24 | | - |
25 | | - format: |
26 | | - name: 👔 Format |
27 | | - uses: ./.github/workflows/format.yml |
28 | | - |
29 | | - lint: |
30 | | - name: 🔬 Lint |
31 | | - uses: ./.github/workflows/lint.yml |
32 | | - |
33 | | - test: |
34 | | - name: 🧪 Test |
35 | | - uses: ./.github/workflows/test.yml |
36 | | - secrets: inherit |
37 | | - |
38 | 10 | release: |
39 | | - name: 🚀 Release |
40 | | - permissions: |
41 | | - id-token: write |
42 | | - contents: write |
43 | | - runs-on: ubuntu-latest |
44 | | - needs: [check, format, lint, test] |
45 | | - if: |
46 | | - needs.check.outputs.changed == 'true' || github.event_name == |
47 | | - 'workflow_dispatch' |
48 | | - steps: |
49 | | - - name: ⬇️ Checkout code |
50 | | - uses: actions/checkout@v4 |
51 | | - |
52 | | - - name: 📦 Setup pnpm |
53 | | - uses: pnpm/action-setup@v4 |
54 | | - with: |
55 | | - version: latest |
56 | | - |
57 | | - - name: ⎔ Setup node |
58 | | - uses: actions/setup-node@v4 |
59 | | - with: |
60 | | - cache: 'pnpm' |
61 | | - node-version: 'node' |
62 | | - registry-url: 'https://registry.npmjs.org' |
63 | | - scope: '@echecs' |
64 | | - |
65 | | - - name: 📥 Install dependencies |
66 | | - run: pnpm install --frozen-lockfile |
67 | | - |
68 | | - - name: Release to NPM |
69 | | - run: pnpm publish --access public --provenance |
70 | | - env: |
71 | | - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
72 | | - |
73 | | - - name: 🏷️ Create GitHub Release |
74 | | - run: | |
75 | | - VERSION="${{ needs.check.outputs.version }}" |
76 | | - NOTES=$(awk -v ver="$VERSION" '/^## /{if(found)exit;v=$2;gsub(/[\[\]]/,"",v);if(v==ver){found=1;next}}found{print}' CHANGELOG.md) |
77 | | - gh release create "v${VERSION}" --title "v${VERSION}" --notes "${NOTES}" |
78 | | - env: |
79 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 11 | + uses: echecsjs/.github/.github/workflows/release.yml@main |
| 12 | + secrets: inherit |
0 commit comments