-
Notifications
You must be signed in to change notification settings - Fork 116
108 lines (90 loc) · 3.21 KB
/
Release-Linux.yaml
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Release-Linux
on:
push:
tags:
- "v*.*.*" # 监听所有以 'v' 开头的标签
workflow_dispatch:
inputs:
tag_name:
description: "Tag to release"
required: true
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [x64, arm64] # 添加架构
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Verify Python Version
run: python --version
- name: Enable Corepack
run: corepack enable
- name: Set Yarn Version
run: corepack prepare yarn
- name: Install dependencies
run: yarn install
- name: Lint code
run: |
yarn lint || (echo "Linting issues found, trying to fix..." && yarn lint-fix)
- name: Build the project for x64
if: matrix.architecture == 'x64'
run: yarn make --arch=x64 --verbose
- name: Build the project for arm64
if: matrix.architecture == 'arm64'
run: yarn make --arch=arm64 --verbose
- name: Find built assets RPM
id: find_assets_rpm
run: |
ASSET_PATH=$(find ./out/make -path './node_modules' -prune -o -name '*.rpm' -print | head -n 1)
ABSOLUTE_ASSET_PATH=$(realpath "$ASSET_PATH")
echo "ASSET_RPM_PATH=$ABSOLUTE_ASSET_PATH" >> $GITHUB_ENV
BASENAME=$(basename "$ASSET_PATH")
echo "ASSET_RPM_BASENAME=$BASENAME" >> $GITHUB_ENV
shell: bash
- name: Find built assets DEB
id: find_assets_deb
run: |
ASSET_PATH=$(find ./out/make -path './node_modules' -prune -o -name '*.deb' -print | head -n 1)
ABSOLUTE_ASSET_PATH=$(realpath "$ASSET_PATH")
echo "ASSET_DEB_PATH=$ABSOLUTE_ASSET_PATH" >> $GITHUB_ENV
BASENAME=$(basename "$ASSET_PATH")
echo "ASSET_DEB_BASENAME=$BASENAME" >> $GITHUB_ENV
shell: bash
- name: Upload Artifacts RPM
id: upload-artifact-rpm
uses: actions/upload-artifact@v4
with:
name: ${{ env.ASSET_RPM_BASENAME }}
path: ${{ env.ASSET_RPM_PATH }}
overwrite: true
- name: Upload Artifacts DEB
id: upload-artifact-deb
uses: actions/upload-artifact@v4
with:
name: ${{ env.ASSET_DEB_BASENAME }}
path: ${{ env.ASSET_DEB_PATH }}
overwrite: true
- name: Create and Upload Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag_name || github.ref_name }}
name: ${{ github.event.inputs.tag_name || github.ref_name }}
files: ${{ env.ASSET_RPM_PATH }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create and Upload Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag_name || github.ref_name }}
name: ${{ github.event.inputs.tag_name || github.ref_name }}
files: ${{ env.ASSET_DEB_PATH }}
token: ${{ secrets.GITHUB_TOKEN }}