|
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 |
|
| 8 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + |
8 | 10 | jobs: |
9 | 11 | release: |
10 | 12 | name: Release |
11 | | - runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + has_changesets: ${{ steps.changesets.outputs.hasChangesets }} |
| 15 | + should_publish: ${{ steps.publish-check.outputs.should_publish }} |
12 | 16 | permissions: |
13 | 17 | contents: write |
14 | | - id-token: write |
15 | 18 | issues: read |
16 | 19 | pull-requests: write |
| 20 | + runs-on: ubuntu-latest |
17 | 21 | steps: |
18 | | - - name: Checkout Repo |
| 22 | + - name: Checkout |
19 | 23 | uses: actions/checkout@v4 |
20 | 24 | with: |
| 25 | + persist-credentials: false |
21 | 26 | # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits |
22 | 27 | fetch-depth: 0 |
23 | 28 |
|
24 | | - - name: Setup Node.js 22.x |
| 29 | + - name: Install Node.js |
| 30 | + uses: actions/setup-node@v4 |
| 31 | + with: |
| 32 | + node-version: 22 |
| 33 | + registry-url: "https://registry.npmjs.org" |
| 34 | + |
| 35 | + - name: Update npm |
| 36 | + run: npm install -g npm@11.11.1 |
| 37 | + |
| 38 | + - name: Install dependencies |
| 39 | + run: npm ci --ignore-scripts |
| 40 | + |
| 41 | + - name: Create Release Pull Request |
| 42 | + id: changesets |
| 43 | + uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3 |
| 44 | + with: |
| 45 | + version: npm run version |
| 46 | + commitMode: github-api |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + |
| 50 | + - name: Check for unpublished package versions |
| 51 | + if: steps.changesets.outputs.hasChangesets == 'false' |
| 52 | + id: publish-check |
| 53 | + run: node .github/scripts/has-unpublished-packages.mjs |
| 54 | + |
| 55 | + publish: |
| 56 | + name: Publish |
| 57 | + needs: release |
| 58 | + if: needs.release.outputs.should_publish == 'true' |
| 59 | + environment: |
| 60 | + name: npm |
| 61 | + url: https://www.npmjs.com/package/preact-render-to-string |
| 62 | + permissions: |
| 63 | + contents: write |
| 64 | + id-token: write |
| 65 | + runs-on: ubuntu-latest |
| 66 | + steps: |
| 67 | + - name: Checkout |
| 68 | + uses: actions/checkout@v4 |
| 69 | + with: |
| 70 | + persist-credentials: false |
| 71 | + |
| 72 | + - name: Install Node.js |
25 | 73 | uses: actions/setup-node@v4 |
26 | 74 | with: |
27 | 75 | node-version: 22 |
28 | | - cache: npm |
29 | 76 | registry-url: "https://registry.npmjs.org" |
30 | 77 |
|
31 | 78 | - name: Update npm |
32 | | - run: npm install -g npm@latest |
| 79 | + run: npm install -g npm@11.11.1 |
| 80 | + |
| 81 | + - name: Install dependencies |
| 82 | + run: npm ci --ignore-scripts |
33 | 83 |
|
34 | | - - name: Install Dependencies |
35 | | - run: npm ci |
| 84 | + - name: Build package |
| 85 | + run: npm run build |
36 | 86 |
|
37 | | - - name: Create Release PR or Publish |
38 | | - uses: changesets/action@v1.5.3 |
| 87 | + - name: Publish packages |
| 88 | + uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3 |
39 | 89 | with: |
40 | | - publish: npx changeset publish |
| 90 | + publish: npm exec -- changeset publish |
| 91 | + commitMode: github-api |
41 | 92 | env: |
42 | 93 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments