Skip to content

Commit

Permalink
CI automatically update Update README with Nightly Build Information …
Browse files Browse the repository at this point in the history
…and stable download URL (janhq#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]>
  • Loading branch information
hiento09 and hientominh authored Dec 11, 2023
1 parent 730dcfc commit 074b18d
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 5 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/jan-electron-build-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: jan-mac-x64-${{ steps.version_update.outputs.new_version }}.dmg
name: jan-mac-x64-${{ steps.version_update.outputs.new_version }}
path: ./electron/dist/jan-mac-x64-${{ steps.version_update.outputs.new_version }}.dmg

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

build-windows-x64:
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: jan-win-x64-${{ steps.version_update.outputs.new_version }}.exe
name: jan-win-x64-${{ steps.version_update.outputs.new_version }}
path: ./electron/dist/*.exe

build-linux-x64:
Expand Down Expand Up @@ -170,11 +170,12 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: jan-linux-amd64-${{ steps.version_update.outputs.new_version }}.deb
name: jan-linux-amd64-${{ steps.version_update.outputs.new_version }}
path: ./electron/dist/*.deb

noti-discord-nightly:
needs: [build-macos, build-windows-x64, build-linux-x64]
environment: production
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
Expand All @@ -185,8 +186,20 @@ jobs:
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

- name: Update README.md with artifact URL
run: |
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
git config --global user.email "[email protected]"
git config --global user.name "Service Account"
git add README.md
git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL"
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main
env:
GITHUB_RUN_ID: ${{ github.run_id }}

noti-discord-manual:
needs: [build-macos, build-windows-x64, build-linux-x64]
environment: production
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
Expand All @@ -196,3 +209,16 @@ jobs:
args: "Manual build artifact: https://github.com/janhq/jan/actions/runs/{{ GITHUB_RUN_ID }}"
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

# Update README.md with artifact URL if manual build from main branch
- name: Update README.md with artifact URL
if: github.ref == 'refs/heads/main'
run: |
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
git config --global user.email "[email protected]"
git config --global user.name "Service Account"
git add README.md
git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL"
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main
env:
GITHUB_RUN_ID: ${{ github.run_id }}
20 changes: 20 additions & 0 deletions .github/workflows/jan-electron-linter-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- "package.json"
- "node_modules/**"
- "yarn.lock"
- "core/**"
- "extensions/**"
- "!README.md"

pull_request:
branches:
Expand Down Expand Up @@ -43,6 +46,11 @@ jobs:
with:
node-version: 20

- name: "Cleanup cache"
continue-on-error: true
run: |
make clean
- name: Linter and test
run: |
make test
Expand All @@ -69,6 +77,13 @@ jobs:
with:
node-version: 20

# Clean cache, continue on error
- name: "Cleanup cache"
shell: powershell
continue-on-error: true
run: |
make clean
- name: Linter and test
shell: powershell
run: |
Expand All @@ -92,6 +107,11 @@ jobs:
with:
node-version: 20

- name: "Cleanup cache"
continue-on-error: true
run: |
make clean
- name: Linter and test
run: |
export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/update-release-url.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Update Download URLs

on:
release:
types:
- published

workflow_dispatch:

jobs:
update-readme:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get Latest Release
uses: pozetroninc/[email protected]
id: get-latest-release

- name: Update Download URLs in README.md
run: |
echo "Latest Release: ${{ steps.get-latest-release.outputs.release }}"
release=$(/bin/echo -n "${{ steps.get-latest-release.outputs.release }}")
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
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
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
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
- name: Commit and Push changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "Service Account"
git add README.md
git commit -m "Update README.md with Stable Download URLs"
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,53 @@ Jan is an open-source ChatGPT alternative that runs 100% offline on your compute
- [x] Linux Debian
- [x] Windows x64

> Download Jan at https://jan.ai/
## Download

<table>
<tr>
<td style="text-align:center"><b>Version Type</b></td>
<td style="text-align:center"><b>Windows</b></td>
<td colspan="2" style="text-align:center"><b>MacOS</b></td>
<td style="text-align:center"><b>Linux</b></td>
</tr>
<tr style="text-align: center">
<td style="text-align:center"><b>Stable (Recommended)</b></td>
<td style="text-align:center">
<a href='https://github.com/janhq/jan/releases/download/v0.4.0/jan-win-x64-0.4.0.exe'>
<img src='./docs/static/img/windows.png' style="height:14px; width: 14px" />
<b>jan.exe</b>
</a>
</td>
<td style="text-align:center">
<a href='https://github.com/janhq/jan/releases/download/v0.4.0/jan-mac-x64-0.4.0.dmg'>
<img src='./docs/static/img/mac.png' style="height:15px; width: 15px" />
<b>Intel</b>
</a>
</td>
<td style="text-align:center">
<a href='https://github.com/janhq/jan/releases/download/v0.4.0/jan-mac-arm64-0.4.0.dmg'>
<img src='./docs/static/img/mac.png' style="height:15px; width: 15px" />
<b>M1/M2</b>
</a>
</td>
<td style="text-align:center">
<a href='https://github.com/janhq/jan/releases/download/v0.4.0/jan-linux-amd64-0.4.0.deb'>
<img src='./docs/static/img/linux.png' style="height:14px; width: 14px" />
<b>jan.deb</b>
</a>
</td>
</tr>
<tr style="text-align: center">
<td style="text-align:center"><b>Experimental (Nighlty Build)</b></td>
<td style="text-align:center" colspan="4">
<a href='https://github.com/janhq/jan/actions/runs/7160001076'>
<b>Github action artifactory</b>
</a>
</td>
</tr>
</table>

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.

## Demo

Expand Down
Binary file added docs/static/img/linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/img/mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/img/windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 074b18d

Please sign in to comment.