|
1 | | -name: 🚀 Publish to NPM |
| 1 | +name: 🚀 Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: [master] |
6 | | - pull_request: |
7 | | - branches: [master] |
8 | 6 |
|
9 | | -# Add permissions for the workflow |
10 | | -permissions: |
11 | | - contents: write |
12 | | - packages: write |
13 | | - issues: write |
14 | | - pull-requests: write |
15 | | - id-token: write |
| 7 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 8 | + |
| 9 | +permissions: {} # reset |
16 | 10 |
|
17 | 11 | jobs: |
18 | 12 | test: |
@@ -44,18 +38,19 @@ jobs: |
44 | 38 | run: echo "✅ All quality checks passed" |
45 | 39 |
|
46 | 40 | release: |
47 | | - name: 🚀 Release with Changesets |
| 41 | + # IMPORTANT: prevent this action from running on forks |
| 42 | + if: github.repository == 'MarcelOlsen/mini-react' |
| 43 | + permissions: |
| 44 | + contents: write # to create release (changesets/action) |
| 45 | + pull-requests: write # to create pull request (changesets/action) |
| 46 | + name: 🚀 Release |
48 | 47 | needs: test |
49 | 48 | runs-on: ubuntu-latest |
50 | | - # Only run on pushes to master |
51 | | - if: github.ref == 'refs/heads/master' && github.event_name == 'push' |
52 | 49 | steps: |
53 | 50 | - name: 📥 Checkout code |
54 | 51 | uses: actions/checkout@v4 |
55 | 52 | with: |
56 | 53 | fetch-depth: 0 |
57 | | - # Use PAT for creating PRs if available, fallback to GITHUB_TOKEN |
58 | | - token: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} |
59 | 54 |
|
60 | 55 | - name: 🟢 Setup Bun |
61 | 56 | uses: oven-sh/setup-bun@v1 |
|
73 | 68 | uses: changesets/action@v1 |
74 | 69 | with: |
75 | 70 | publish: bunx changeset publish |
76 | | - version: bunx changeset version && bun run check:write |
77 | | - commit: "chore: release package" |
78 | | - title: "chore: release package" |
79 | 71 | env: |
80 | | - # Use PAT for creating PRs if available, fallback to GITHUB_TOKEN |
81 | | - GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} |
| 72 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
82 | 73 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments