Skip to content

Commit 45b1794

Browse files
authored
Create release1.yml
1 parent 324a10e commit 45b1794

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/release1.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Create Release on Tag Push
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
# Checkout
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
# Install Node.js
17+
- name: Install Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 20
21+
registry-url: "https://registry.npmjs.org"
22+
23+
# Install pnpm
24+
- name: Install pnpm
25+
uses: pnpm/action-setup@v4
26+
id: pnpm-install
27+
with:
28+
version: 9.10.0
29+
run_install: false
30+
31+
# Get pnpm store directory
32+
- name: Get pnpm store directory
33+
id: pnpm-cache
34+
shell: bash
35+
run: |
36+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
37+
38+
# Setup pnpm cache
39+
- name: Setup pnpm cache
40+
uses: actions/cache@v3
41+
with:
42+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
43+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pnpm-store-
46+
47+
# Install dependencies
48+
- name: Install dependencies
49+
run: pnpm install
50+
51+
# Build for production, 这一步会生成一个 package.zip
52+
- name: Build for production
53+
run: pnpm build
54+
55+
- name: Release
56+
uses: ncipollo/release-action@v1
57+
with:
58+
allowUpdates: true
59+
artifactErrorsFailBuild: true
60+
artifacts: "package.zip"
61+
token: ${{ secrets.GITHUB_TOKEN }}
62+
prerelease: false

0 commit comments

Comments
 (0)