-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (74 loc) · 2.22 KB
/
release.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
name: CRETA RELEASE
# 指定此工作流的触发器
on:
push:
# 匹配特定标签 (refs/tags)
tags:
- 'v*' # 推送事件匹配 v*, 例如 v1.0,v20.15.10 等来触发工作流
env:
CARGO_TERM_COLOR: always
jobs:
RELEASE:
runs-on: macos-latest
strategy:
matrix:
rust: [stable]
env:
NODE_VERSION: '18.x'
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
# 查询版本号(tag)
- name: Query version number
id: get_version
shell: bash
# GITHUB_REF "refs/tags/v1.2.3" GITHUB_REF:10 表示从第十位开始截取字符串,得到 v1.2.3
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:11}"
# 安装 pnpm 以及依赖
- name: Install Pnpm dependencies
run: |
npm i -g pnpm
pnpm install
# 更新 package.json 版本号
- name: Update version number
run: |
node scripts/version.js ${{ steps.get_version.outputs.VERSION }}
- name: PrePublish creta -- Install Mingw-W64 dependencies
run: |
rustup target add x86_64-pc-windows-gnu
brew install mingw-w64
- name: PrePublish creta -- Compile Creta Updater
run: |
cd src/creta/creta-updater
cargo build --release
cargo build --release --target x86_64-pc-windows-gnu
- name: Publish creta
run: |
cd src/creta
npm publish
cd ../..
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish create-creta
run: |
cd src/cli
npm publish
cd ../..
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.get_version.outputs.VERSION }}
name: Release v${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
env:
GITHUB_REPOSITORY: ch1ny/creta