@@ -8,33 +8,71 @@ concurrency:
88 cancel-in-progress : true
99
1010jobs :
11- build :
12- name : 🏗️ Build
13- runs-on : windows-latest
14- strategy :
15- fail-fast : false
11+ version-bump :
12+ name : 🔢 Version Bump
13+ runs-on : ubuntu-latest
1614 steps :
1715 - name : ⬇️ Checkout repo
1816 uses : actions/checkout@v4
1917 with :
20- fetch-depth : 2
18+ fetch-depth : 0
19+
20+ - name : Automated Version Bump
21+ uses : phips28/gh-action-bump-version@master
22+ env :
23+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
24+ with :
25+ commit-message : ' CI: bumps version to {{version}} [skip ci]'
26+ skip-tag : ' true'
2127
22- - name : Set up conda
23- uses : conda-incubator/setup-miniconda@v2
28+ build-linux :
29+ name : 🏗️ Build Linux
30+ runs-on : ubuntu-latest
31+ needs : version-bump
32+ steps :
33+ - name : ⬇️ Checkout repo
34+ uses : actions/checkout@v4
2435 with :
25- activate-environment : default
26- environment-file : api/environment.yml
36+ fetch-depth : 0
2737
38+ - name : Install dependencies
39+ run : npm install
40+
41+ - name : 📦 Electron Builder Linux
42+ run : npm run electron:package:linux
43+ env :
44+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45+
46+ - name : Upload Linux artifact
47+ uses : actions/upload-artifact@v2
48+ with :
49+ name : LinguifAI-Linux
50+ path : dist/*.AppImage
51+
52+
53+ build-windows :
54+ name : 🏗️ Build Windows
55+ runs-on : windows-latest
56+ needs : version-bump
57+ strategy :
58+ fail-fast : false
59+ steps :
2860 - name : ⬇️ Checkout repo
2961 uses : actions/checkout@v4
3062 with :
31- fetch-depth : 2
63+ fetch-depth : 0
3264
3365 - name : ⎔ Setup Node
3466 uses : actions/setup-node@v3
3567 with :
3668 cache : " npm"
3769
70+ - name : Set up conda
71+ uses : conda-incubator/setup-miniconda@v2
72+ with :
73+ activate-environment : default
74+ environment-file : api/environment.yml
75+
3876 - name : 🟨 Setup Python
3977 uses : actions/setup-python@v3
4078 with :
@@ -49,42 +87,72 @@ jobs:
4987 - name : Install dependencies
5088 run : npm install
5189
52- - name : 📦 Electron Builder
90+ - name : 📦 Electron Builder Windows
5391 run : npm run electron:package:win
5492 env :
5593 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5694
57- - name : Print directory tree
58- run : tree
95+ - name : Upload Windows artifact
96+ uses : actions/upload-artifact@v2
97+ with :
98+ name : LinguifAI-Windows
99+ path : dist/*.exe
100+
101+ publish-release :
102+ name : 🚀 Publish Release
103+ runs-on : ubuntu-latest
104+ needs : [build-linux, build-windows]
105+ steps :
106+ - name : ⬇️ Checkout repo
107+ uses : actions/checkout@v4
108+ with :
109+ fetch-depth : 0
110+
111+ - name : Get version of the project
112+ id : project-version
113+ uses : euberdeveloper/ga-project-version@main
59114
60- - name : Get latest release number
61- id : get_latest_release
62- uses : actions/github-script@v4
115+ - name : Download Linux artifact
116+ uses : actions/download-artifact@v2
63117 with :
64- github-token : ${{ secrets.GITHUB_TOKEN }}
65- script : |
66- const response = await github.repos.listReleases({
67- owner: context.repo.owner,
68- repo: context.repo.repo,
69- per_page: 10
70- });
71-
72- const latestPreRelease = response.data[0];
73- const preReleaseTag = latestPreRelease.name;
74- const versionParts = preReleaseTag.replace(/^v/, '').split('.');
75- const newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])}.${parseInt(versionParts[2]) + 1}`;
76- console.log(`::set-output name=new_version::${newVersion}`);
77-
78- - name : Rename file
79- run : ren "dist\LinguifAI Setup 0.1.0.exe" "LinguifAI Setup ${{ steps.get_latest_release.outputs.new_version }}.exe"
118+ name : LinguifAI-Linux
119+ path : dist/
120+
121+ - name : Download Windows artifact
122+ uses : actions/download-artifact@v2
123+ with :
124+ name : LinguifAI-Windows
125+ path : dist/
80126
81127 - name : Create Release
82128 id : create_release
83- uses : softprops/action-gh-release@v1
129+ uses : actions/create-release@v1
130+ env :
131+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
84132 with :
85- files : |
86- ./dist/LinguifAI\ Setup\ ${{ steps.get_latest_release.outputs.new_version }}.exe
87- tag_name : v${{ steps.get_latest_release.outputs.new_version }}
88- name : v${{ steps.get_latest_release.outputs.new_version }}
133+ tag_name : v${{ steps.project-version.outputs.version }}
134+ release_name : v${{ steps.project-version.outputs.version }}
135+ draft : false
89136 prerelease : true
90- body : ${{ github.event.head_commit.message }}
137+
138+ - name : Upload Linux artifact
139+ id : upload-linux
140+ uses : actions/upload-release-asset@v1
141+ env :
142+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
143+ with :
144+ upload_url : ${{ steps.create_release.outputs.upload_url }}
145+ asset_path : dist/LinguifAI-${{ steps.project-version.outputs.version }}.AppImage
146+ asset_name : LinguifAI-${{ steps.project-version.outputs.version }}.AppImage
147+ asset_content_type : application/octet-stream
148+
149+ - name : Upload Windows artifact
150+ id : upload-windows
151+ uses : actions/upload-release-asset@v1
152+ env :
153+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
154+ with :
155+ upload_url : ${{ steps.create_release.outputs.upload_url }}
156+ asset_path : dist/LinguifAI Setup ${{ steps.project-version.outputs.version }}.exe
157+ asset_name : LinguifAI-Setup-${{ steps.project-version.outputs.version }}.exe
158+ asset_content_type : application/octet-stream
0 commit comments