Skip to content

Commit 4261c7c

Browse files
committed
add release workflow
1 parent c730260 commit 4261c7c

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
env:
15+
CI: true
16+
CACHE_PREFIX: stable
17+
NODE_VERSION: 16
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: Use Node.js ${{ env.NODE_VERSION }}
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: ${{ env.NODE_VERSION }}
30+
registry-url: "https://registry.npmjs.org"
31+
32+
- name: Use cached node_modules
33+
id: cache
34+
uses: actions/cache@v3
35+
with:
36+
path: node_modules
37+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}
38+
39+
- name: Install dependencies
40+
run: npm install
41+
42+
- name: Build Prettier Plugin
43+
run: |
44+
npm run build
45+
46+
- name: Test
47+
run: |
48+
npm run test
49+
50+
- name: Calculate environment variables
51+
run: |
52+
echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
53+
54+
- name: Publish
55+
run: npm publish --tag ${{ env.RELEASE_CHANNEL }}
56+
env:
57+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)