|
1 | | -name: release |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - tags: |
6 | | - - "v*" |
7 | | - workflow_dispatch: |
| 4 | + release: |
| 5 | + types: [published] |
8 | 6 |
|
9 | 7 | # Remove default permissions of GITHUB_TOKEN for security |
10 | 8 | # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs |
11 | | -permissions: {} |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + id-token: write |
12 | 12 |
|
13 | 13 | jobs: |
14 | 14 | release: |
15 | | - concurrency: |
16 | | - group: release |
17 | | - permissions: |
18 | | - contents: write |
19 | | - id-token: write |
20 | 15 | runs-on: ubuntu-latest |
21 | | - timeout-minutes: 20 |
22 | 16 | steps: |
23 | 17 | - uses: actions/checkout@v4 |
24 | 18 | with: |
| 19 | + ref: ${{ github.event.release.target_commitish }} |
25 | 20 | fetch-depth: 0 |
| 21 | + |
26 | 22 | - uses: oven-sh/setup-bun@v2 |
27 | 23 | with: |
28 | 24 | bun-version: latest |
29 | 25 |
|
| 26 | + - name: Extract version from tag |
| 27 | + id: version |
| 28 | + run: | |
| 29 | + VERSION=${GITHUB_REF#refs/tags/v} |
| 30 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 31 | + echo "Publishing version: $VERSION" |
| 32 | +
|
| 33 | + - name: Update package versions |
| 34 | + run: ./scripts/update-version.sh ${{ steps.version.outputs.version }} |
| 35 | + |
30 | 36 | - name: Install dependencies |
31 | 37 | run: bun install |
32 | 38 |
|
33 | | - - name: Build (stub) |
34 | | - run: bun run dev:prepare |
35 | | - |
36 | | - - name: Build project |
| 39 | + - name: Build packages |
37 | 40 | run: bun run build |
38 | 41 |
|
39 | 42 | - name: Publish nuxt-auto-api to npm |
40 | 43 | run: cd packages/nuxt-auto-api && npm publish --provenance --access public |
41 | | - env: |
42 | | - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
43 | 44 |
|
44 | 45 | - name: Publish nuxt-auto-admin to npm |
45 | 46 | run: cd packages/nuxt-auto-admin && npm publish --provenance --access public |
46 | | - env: |
47 | | - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 47 | + |
| 48 | + - name: Commit version updates |
| 49 | + run: | |
| 50 | + VERSION=${{ steps.version.outputs.version }} |
| 51 | + git config user.name "github-actions[bot]" |
| 52 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 53 | + git add packages/*/package.json |
| 54 | + git commit -m "chore: update versions to $VERSION [skip ci]" || echo "No changes to commit" |
| 55 | + git push origin HEAD:${{ github.event.release.target_commitish }} || echo "No changes to push" |
0 commit comments