Skip to content

Commit 5678430

Browse files
committed
ci: release
1 parent 6c09733 commit 5678430

File tree

2 files changed

+105
-9
lines changed

2 files changed

+105
-9
lines changed

.github/workflows/make.yml

+104-8
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,141 @@ on:
66
- 'main'
77
workflow_dispatch:
88

9+
env:
10+
VERSION: 1.0.${{ github.run_number }} # 动态版本号,基于当前工作流运行次数
11+
912
jobs:
1013
linux:
1114
runs-on: ubuntu-latest
1215
steps:
13-
- name: checkout
16+
- name: Checkout code
1417
uses: actions/checkout@v3
1518
with:
1619
fetch-depth: 0
1720

21+
- name: Set version
22+
run: |
23+
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" package.json
24+
1825
- name: Install dependencies with Yarn
1926
run: yarn install
2027

21-
- name: make
22-
run: yarn make
28+
- name: Build for Linux
29+
run: |
30+
yarn make
31+
32+
- name: Upload Linux Artifact
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: linux-artifact
36+
path: out/make
2337

2438
windows:
2539
runs-on: windows-latest
2640
steps:
27-
- name: checkout
41+
- name: Checkout code
2842
uses: actions/checkout@v3
2943
with:
3044
fetch-depth: 0
3145

46+
- name: Set version
47+
run: |
48+
powershell -Command "(gc package.json) -replace '\"version\": \".*\"', '\"version\": \"$VERSION\"' | Set-Content package.json"
49+
3250
- name: Install dependencies with Yarn
3351
run: yarn install
3452

35-
- name: make
53+
- name: Build for Windows
3654
run: yarn make
3755

56+
- name: Upload Windows Artifact
57+
uses: actions/upload-artifact@v3
58+
with:
59+
name: windows-artifact
60+
path: out/make
61+
3862
macos:
3963
runs-on: macos-latest
4064
steps:
41-
- name: checkout
65+
- name: Checkout code
4266
uses: actions/checkout@v3
4367
with:
4468
fetch-depth: 0
4569

70+
- name: Set version
71+
run: |
72+
sed -i '' "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" package.json
73+
4674
- name: Install dependencies with Yarn
4775
run: yarn install
4876

49-
- name: make
50-
run: yarn make
77+
- name: Build for macOS
78+
run: yarn make
79+
80+
- name: Upload macOS Artifact
81+
uses: actions/upload-artifact@v3
82+
with:
83+
name: macos-artifact
84+
path: out/make
85+
86+
release:
87+
needs: [linux, windows, macos]
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Download Linux Artifact
91+
uses: actions/download-artifact@v3
92+
with:
93+
name: linux-artifact
94+
path: dist/linux
95+
96+
- name: Download Windows Artifact
97+
uses: actions/download-artifact@v3
98+
with:
99+
name: windows-artifact
100+
path: dist/windows
101+
102+
- name: Download macOS Artifact
103+
uses: actions/download-artifact@v3
104+
with:
105+
name: macos-artifact
106+
path: dist/macos
107+
108+
- name: Create Release
109+
uses: actions/create-release@v1
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
with:
113+
tag_name: v${{ env.VERSION }}
114+
release_name: Git Helper v${{ env.VERSION }}
115+
draft: false
116+
prerelease: false
117+
118+
- name: Upload Linux Asset
119+
uses: actions/upload-release-asset@v1
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
with:
123+
upload_url: ${{ steps.create_release.outputs.upload_url }}
124+
asset_path: dist/linux
125+
asset_name: linux.zip
126+
asset_content_type: application/zip
127+
128+
- name: Upload Windows Asset
129+
uses: actions/upload-release-asset@v1
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
with:
133+
upload_url: ${{ steps.create_release.outputs.upload_url }}
134+
asset_path: dist/windows
135+
asset_name: windows.zip
136+
asset_content_type: application/zip
137+
138+
- name: Upload macOS Asset
139+
uses: actions/upload-release-asset@v1
140+
env:
141+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142+
with:
143+
upload_url: ${{ steps.create_release.outputs.upload_url }}
144+
asset_path: dist/macos
145+
asset_name: macos.zip
146+
asset_content_type: application/zip

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "GitHelper",
33
"version": "1.0.0",
4-
"description": "一键配置git,帮助新手快速上手",
4+
"description": "一键配置git,帮助新人快速上手",
55
"main": "main/main.js",
66
"dependencies": {
77
"boolean": "^3.2.0",

0 commit comments

Comments
 (0)