-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (64 loc) · 2.07 KB
/
release-please.yml
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
name: Release and Publish
on:
push:
branches:
- main # Trigger on push to the main branch
jobs:
release:
name: Automated Release with NPM Publish
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
# Step 1: Checkout the repository
- name: Checkout
uses: actions/checkout@v3
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22' # Specify Node.js version
cache: 'yarn' # Use Yarn and cache dependencies
# Step 3: Install dependencies with Yarn
- name: Install dependencies
run: yarn install
# Step 4: Run tests (optional)
- name: Run tests
run: yarn test
# Step 5: Build the project (optional)
- name: Build project
run: yarn build
# Step 6: Use Release Please to automatically create a release
- name: Release Please
uses: google-github-actions/release-please-action@v4
with:
release-type: node # Can be node, npm, or based on your project type
package-name: lit-functions
token: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub automatically
publish:
name: Publish to npm
needs: release
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout
uses: actions/checkout@v3
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22' # Specify Node.js version
cache: 'yarn' # Use Yarn and cache dependencies
always-auth: true
# Step 3: Install dependencies with Yarn
- name: Install dependencies
run: yarn install
- name: Build library
run: yarn build
# Step 4: Publish to npm
- name: Publish to npm
run: yarn publish --non-interactive --access public
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}