-
-
Notifications
You must be signed in to change notification settings - Fork 34
93 lines (79 loc) · 2.57 KB
/
Copy pathrelease.yml
File metadata and controls
93 lines (79 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
outputs:
has_changesets: ${{ steps.changesets.outputs.hasChangesets }}
should_publish: ${{ steps.publish-check.outputs.should_publish }}
permissions:
contents: write
issues: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Install Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
package-manager-cache: false
node-version-file: package.json
registry-url: "https://registry.npmjs.org"
- name: Update npm
run: npm install -g npm@11.11.1
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Create Release Pull Request
id: changesets
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
with:
version: npm run version
commitMode: github-api
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for unpublished package versions
if: steps.changesets.outputs.hasChangesets == 'false'
id: publish-check
run: node .github/scripts/has-unpublished-packages.mjs
publish:
name: Publish
needs: release
if: needs.release.outputs.should_publish == 'true'
environment:
name: npm
url: https://www.npmjs.com/package/@preact/preset-vite
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Install Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
package-manager-cache: false
node-version: 22
registry-url: "https://registry.npmjs.org"
- name: Update npm
run: npm install -g npm@11.11.1
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build package
run: npm run build
- name: Publish packages
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
with:
publish: npm exec -- changeset publish
commitMode: github-api
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}