Skip to content

Commit 074b18d

Browse files
authored
CI automatically update Update README with Nightly Build Information and stable download URL (#940)
* Add table download to README * CI update Nightly Build URL on github README.md file * Add CI to update latest release url to README.md * Add clean cache to test pipeline * set style=text-align:center in download table * Manual build update experimental URL if triggered from main branch --------- Co-authored-by: Hien To <[email protected]>
1 parent 730dcfc commit 074b18d

File tree

7 files changed

+134
-5
lines changed

7 files changed

+134
-5
lines changed

.github/workflows/jan-electron-build-nightly.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ jobs:
6868
- name: Upload Artifact
6969
uses: actions/upload-artifact@v2
7070
with:
71-
name: jan-mac-x64-${{ steps.version_update.outputs.new_version }}.dmg
71+
name: jan-mac-x64-${{ steps.version_update.outputs.new_version }}
7272
path: ./electron/dist/jan-mac-x64-${{ steps.version_update.outputs.new_version }}.dmg
7373

7474
- name: Upload Artifact
7575
uses: actions/upload-artifact@v2
7676
with:
77-
name: jan-mac-arm64-${{ steps.version_update.outputs.new_version }}.dmg
77+
name: jan-mac-arm64-${{ steps.version_update.outputs.new_version }}
7878
path: ./electron/dist/jan-mac-arm64-${{ steps.version_update.outputs.new_version }}.dmg
7979

8080
build-windows-x64:
@@ -124,7 +124,7 @@ jobs:
124124
- name: Upload Artifact
125125
uses: actions/upload-artifact@v2
126126
with:
127-
name: jan-win-x64-${{ steps.version_update.outputs.new_version }}.exe
127+
name: jan-win-x64-${{ steps.version_update.outputs.new_version }}
128128
path: ./electron/dist/*.exe
129129

130130
build-linux-x64:
@@ -170,11 +170,12 @@ jobs:
170170
- name: Upload Artifact
171171
uses: actions/upload-artifact@v2
172172
with:
173-
name: jan-linux-amd64-${{ steps.version_update.outputs.new_version }}.deb
173+
name: jan-linux-amd64-${{ steps.version_update.outputs.new_version }}
174174
path: ./electron/dist/*.deb
175175

176176
noti-discord-nightly:
177177
needs: [build-macos, build-windows-x64, build-linux-x64]
178+
environment: production
178179
if: github.event_name == 'schedule'
179180
runs-on: ubuntu-latest
180181
steps:
@@ -185,8 +186,20 @@ jobs:
185186
env:
186187
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
187188

189+
- name: Update README.md with artifact URL
190+
run: |
191+
sed -i "s|<a href='https://github.com/janhq/jan/actions/runs/.*'>|<a href='https://github.com/janhq/jan/actions/runs/${GITHUB_RUN_ID}'>|" README.md
192+
git config --global user.email "[email protected]"
193+
git config --global user.name "Service Account"
194+
git add README.md
195+
git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL"
196+
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main
197+
env:
198+
GITHUB_RUN_ID: ${{ github.run_id }}
199+
188200
noti-discord-manual:
189201
needs: [build-macos, build-windows-x64, build-linux-x64]
202+
environment: production
190203
if: github.event_name == 'workflow_dispatch'
191204
runs-on: ubuntu-latest
192205
steps:
@@ -196,3 +209,16 @@ jobs:
196209
args: "Manual build artifact: https://github.com/janhq/jan/actions/runs/{{ GITHUB_RUN_ID }}"
197210
env:
198211
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
212+
213+
# Update README.md with artifact URL if manual build from main branch
214+
- name: Update README.md with artifact URL
215+
if: github.ref == 'refs/heads/main'
216+
run: |
217+
sed -i "s|<a href='https://github.com/janhq/jan/actions/runs/.*'>|<a href='https://github.com/janhq/jan/actions/runs/${GITHUB_RUN_ID}'>|" README.md
218+
git config --global user.email "[email protected]"
219+
git config --global user.name "Service Account"
220+
git add README.md
221+
git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL"
222+
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main
223+
env:
224+
GITHUB_RUN_ID: ${{ github.run_id }}

.github/workflows/jan-electron-linter-and-test.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
- "package.json"
1212
- "node_modules/**"
1313
- "yarn.lock"
14+
- "core/**"
15+
- "extensions/**"
16+
- "!README.md"
1417

1518
pull_request:
1619
branches:
@@ -43,6 +46,11 @@ jobs:
4346
with:
4447
node-version: 20
4548

49+
- name: "Cleanup cache"
50+
continue-on-error: true
51+
run: |
52+
make clean
53+
4654
- name: Linter and test
4755
run: |
4856
make test
@@ -69,6 +77,13 @@ jobs:
6977
with:
7078
node-version: 20
7179

80+
# Clean cache, continue on error
81+
- name: "Cleanup cache"
82+
shell: powershell
83+
continue-on-error: true
84+
run: |
85+
make clean
86+
7287
- name: Linter and test
7388
shell: powershell
7489
run: |
@@ -92,6 +107,11 @@ jobs:
92107
with:
93108
node-version: 20
94109

110+
- name: "Cleanup cache"
111+
continue-on-error: true
112+
run: |
113+
make clean
114+
95115
- name: Linter and test
96116
run: |
97117
export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Update Download URLs
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
workflow_dispatch:
9+
10+
jobs:
11+
update-readme:
12+
runs-on: ubuntu-latest
13+
environment: production
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Get Latest Release
19+
uses: pozetroninc/[email protected]
20+
id: get-latest-release
21+
22+
- name: Update Download URLs in README.md
23+
run: |
24+
echo "Latest Release: ${{ steps.get-latest-release.outputs.release }}"
25+
release=$(/bin/echo -n "${{ steps.get-latest-release.outputs.release }}")
26+
sed -i "s|<a href='https://github.com/janhq/jan/releases/download/v.*/jan-win-x64-.*'>|<a href='https://github.com/janhq/jan/releases/download/v${release}/jan-win-x64-${release}.exe'>|" README.md
27+
sed -i "s|<a href='https://github.com/janhq/jan/releases/download/v.*/jan-mac-x64-.*'>|<a href='https://github.com/janhq/jan/releases/download/v${release}/jan-mac-x64-${release}.dmg'>|" README.md
28+
sed -i "s|<a href='https://github.com/janhq/jan/releases/download/v.*/jan-mac-arm64-.*'>|<a href='https://github.com/janhq/jan/releases/download/v${release}/jan-mac-arm64-${release}.dmg'>|" README.md
29+
sed -i "s|<a href='https://github.com/janhq/jan/releases/download/v.*/jan-linux-amd64-.*'>|<a href='https://github.com/janhq/jan/releases/download/v${release}/jan-linux-amd64-${release}.deb'>|" README.md
30+
31+
- name: Commit and Push changes
32+
run: |
33+
git config --global user.email "[email protected]"
34+
git config --global user.name "Service Account"
35+
git add README.md
36+
git commit -m "Update README.md with Stable Download URLs"
37+
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,53 @@ Jan is an open-source ChatGPT alternative that runs 100% offline on your compute
3131
- [x] Linux Debian
3232
- [x] Windows x64
3333

34-
> Download Jan at https://jan.ai/
34+
## Download
35+
36+
<table>
37+
<tr>
38+
<td style="text-align:center"><b>Version Type</b></td>
39+
<td style="text-align:center"><b>Windows</b></td>
40+
<td colspan="2" style="text-align:center"><b>MacOS</b></td>
41+
<td style="text-align:center"><b>Linux</b></td>
42+
</tr>
43+
<tr style="text-align: center">
44+
<td style="text-align:center"><b>Stable (Recommended)</b></td>
45+
<td style="text-align:center">
46+
<a href='https://github.com/janhq/jan/releases/download/v0.4.0/jan-win-x64-0.4.0.exe'>
47+
<img src='./docs/static/img/windows.png' style="height:14px; width: 14px" />
48+
<b>jan.exe</b>
49+
</a>
50+
</td>
51+
<td style="text-align:center">
52+
<a href='https://github.com/janhq/jan/releases/download/v0.4.0/jan-mac-x64-0.4.0.dmg'>
53+
<img src='./docs/static/img/mac.png' style="height:15px; width: 15px" />
54+
<b>Intel</b>
55+
</a>
56+
</td>
57+
<td style="text-align:center">
58+
<a href='https://github.com/janhq/jan/releases/download/v0.4.0/jan-mac-arm64-0.4.0.dmg'>
59+
<img src='./docs/static/img/mac.png' style="height:15px; width: 15px" />
60+
<b>M1/M2</b>
61+
</a>
62+
</td>
63+
<td style="text-align:center">
64+
<a href='https://github.com/janhq/jan/releases/download/v0.4.0/jan-linux-amd64-0.4.0.deb'>
65+
<img src='./docs/static/img/linux.png' style="height:14px; width: 14px" />
66+
<b>jan.deb</b>
67+
</a>
68+
</td>
69+
</tr>
70+
<tr style="text-align: center">
71+
<td style="text-align:center"><b>Experimental (Nighlty Build)</b></td>
72+
<td style="text-align:center" colspan="4">
73+
<a href='https://github.com/janhq/jan/actions/runs/7160001076'>
74+
<b>Github action artifactory</b>
75+
</a>
76+
</td>
77+
</tr>
78+
</table>
79+
80+
Download the latest version of Jan at https://jan.ai/ or visit the **[GitHub Releases](https://github.com/janhq/jan/releases)** to download any previous release.
3581

3682
## Demo
3783

docs/static/img/linux.png

49.8 KB
Loading

docs/static/img/mac.png

5.64 KB
Loading

docs/static/img/windows.png

5.9 KB
Loading

0 commit comments

Comments
 (0)