Skip to content

Commit 717b355

Browse files
committed
Add nightly build ci
1 parent 70a8d03 commit 717b355

File tree

3 files changed

+192
-5
lines changed

3 files changed

+192
-5
lines changed
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
name: Jan Build Electron App Nightly
2+
3+
on:
4+
schedule:
5+
- cron: '0 16 * * *' # At 4 PM UTC, which is 11 AM UTC+7
6+
7+
workflow_dispatch:
8+
inputs:
9+
branch:
10+
description: 'Branch to build'
11+
required: true
12+
default: 'main'
13+
14+
jobs:
15+
build-macos:
16+
runs-on: macos-latest
17+
environment: production
18+
permissions:
19+
contents: write
20+
steps:
21+
- name: Getting the repo
22+
uses: actions/checkout@v3
23+
24+
- name: Installing node
25+
uses: actions/setup-node@v1
26+
with:
27+
node-version: 20
28+
29+
- name: Install jq
30+
uses: dcarbone/[email protected]
31+
32+
33+
- name: Update app version based on latest release tag with build number
34+
id: version_update
35+
run: |
36+
# Get the latest release tag from GitHub API
37+
LATEST_TAG=$(curl -s https://api.github.com/repos/janhq/jan/releases/latest | jq -r .tag_name)
38+
39+
# Remove the 'v' and append the build number to the version
40+
NEW_VERSION="${LATEST_TAG#v}-${GITHUB_RUN_NUMBER}"
41+
echo "New version: $NEW_VERSION"
42+
43+
# Update the version in electron/package.json
44+
jq --arg version "$NEW_VERSION" '.version = $version' electron/package.json > /tmp/package.json
45+
mv /tmp/package.json electron/package.json
46+
echo "::set-output name=new_version::$NEW_VERSION"
47+
48+
- name: Get Cer for code signing
49+
run: base64 -d <<< "$CODE_SIGN_P12_BASE64" > /tmp/codesign.p12
50+
shell: bash
51+
env:
52+
CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
53+
54+
- uses: apple-actions/import-codesign-certs@v2
55+
continue-on-error: true
56+
with:
57+
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
58+
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
59+
60+
- name: Build and publish app
61+
run: |
62+
make build
63+
env:
64+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
CSC_LINK: "/tmp/codesign.p12"
66+
CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
67+
CSC_IDENTITY_AUTO_DISCOVERY: "true"
68+
APPLE_ID: ${{ secrets.APPLE_ID }}
69+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
70+
APP_PATH: "."
71+
DEVELOPER_ID: ${{ secrets.DEVELOPER_ID }}
72+
73+
- name: Upload Artifact
74+
uses: actions/upload-artifact@v2
75+
with:
76+
name: jan-mac-x64-${{ steps.version_update.outputs.new_version }}.dmg.zip
77+
path: ./electron/dist/jan-mac-x64-${{ steps.version_update.outputs.new_version }}.dmg
78+
79+
- name: Upload Artifact
80+
uses: actions/upload-artifact@v2
81+
with:
82+
name: jan-mac-arm64-${{ steps.version_update.outputs.new_version }}.dmg.zip
83+
path: ./electron/dist/jan-mac-arm64-${{ steps.version_update.outputs.new_version }}.dmg
84+
85+
build-windows-x64:
86+
runs-on: windows-latest
87+
permissions:
88+
contents: write
89+
steps:
90+
- name: Getting the repo
91+
uses: actions/checkout@v3
92+
93+
- name: Installing node
94+
uses: actions/setup-node@v1
95+
with:
96+
node-version: 20
97+
98+
- name: Install jq
99+
uses: dcarbone/[email protected]
100+
101+
- name: Update app version base on tag
102+
id: version_update
103+
shell: bash
104+
run: |
105+
# Get the latest release tag from GitHub API
106+
LATEST_TAG=$(curl -s https://api.github.com/repos/janhq/jan/releases/latest | jq -r .tag_name)
107+
108+
# Remove the 'v' and append the build number to the version
109+
NEW_VERSION="${LATEST_TAG#v}-${GITHUB_RUN_NUMBER}"
110+
echo "New version: $NEW_VERSION"
111+
112+
# Update the version in electron/package.json
113+
jq --arg version "$NEW_VERSION" '.version = $version' electron/package.json > /tmp/package.json
114+
mv /tmp/package.json electron/package.json
115+
116+
echo "::set-output name=new_version::$NEW_VERSION"
117+
118+
- name: Build app
119+
shell: cmd
120+
run: |
121+
make build
122+
123+
- name: Windows Code Sign with AzureSignTool
124+
run: |
125+
dotnet tool install --global AzureSignTool
126+
cd ./electron/dist
127+
azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v "jan-win-x64-${{ steps.version_update.outputs.new_version }}.exe"
128+
129+
- name: Upload Artifact
130+
uses: actions/upload-artifact@v2
131+
with:
132+
name: jan-win-x64-${{ steps.version_update.outputs.new_version }}.exe.zip
133+
path: ./electron/dist/*.exe
134+
135+
build-linux-x64:
136+
runs-on: ubuntu-latest
137+
environment: production
138+
env:
139+
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
140+
permissions:
141+
contents: write
142+
steps:
143+
- name: Getting the repo
144+
uses: actions/checkout@v3
145+
146+
- name: Installing node
147+
uses: actions/setup-node@v1
148+
with:
149+
node-version: 20
150+
151+
- name: Install jq
152+
uses: dcarbone/[email protected]
153+
154+
- name: Update app version base on tag
155+
id: version_update
156+
run: |
157+
# Get the latest release tag from GitHub API
158+
LATEST_TAG=$(curl -s https://api.github.com/repos/janhq/jan/releases/latest | jq -r .tag_name)
159+
160+
# Remove the 'v' and append the build number to the version
161+
NEW_VERSION="${LATEST_TAG#v}-${GITHUB_RUN_NUMBER}"
162+
echo "New version: $NEW_VERSION"
163+
164+
# Update the version in electron/package.json
165+
jq --arg version "$NEW_VERSION" '.version = $version' electron/package.json > /tmp/package.json
166+
mv /tmp/package.json electron/package.json
167+
echo "::set-output name=new_version::$NEW_VERSION"
168+
169+
- name: Build and publish app
170+
run: |
171+
make build
172+
env:
173+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174+
175+
- name: Upload Artifact
176+
uses: actions/upload-artifact@v2
177+
with:
178+
name: jan-linux-amd64-${{ steps.version_update.outputs.new_version }}.deb.zip
179+
path: ./electron/dist/*.deb
180+
181+
noti-discord:
182+
needs: [build-macos, build-windows-x64, build-linux-x64]
183+
runs-on: ubuntu-latest
184+
steps:
185+
- name: Notify Discord
186+
uses: Ilshidur/action-discord@master
187+
with:
188+
args: "Nightly build artifact: https://github.com/janhq/jan/actions/runs/{{ GITHUB_RUN_ID }}"
189+
env:
190+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ jobs:
182182
- name: Install jq
183183
uses: dcarbone/[email protected]
184184

185-
- name: Install Snapcraft
186-
uses: samuelmeuli/action-snapcraft@v2
187-
188185
- name: Get tag
189186
id: tag
190187
uses: dawidd6/action-get-tag@v1

electron/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656
"build:test:darwin": "tsc -p . && electron-builder -p never -m --dir",
5757
"build:test:win32": "tsc -p . && electron-builder -p never -w --dir",
5858
"build:test:linux": "tsc -p . && electron-builder -p never -l --dir",
59-
"build:darwin": "tsc -p . && electron-builder -p never -m",
59+
"build:darwin": "tsc -p . && electron-builder -p never -m --x64 --arm64",
6060
"build:win32": "tsc -p . && electron-builder -p never -w",
61-
"build:linux": "tsc -p . && electron-builder -p never --linux deb",
61+
"build:linux": "tsc -p . && electron-builder -p never -l deb",
6262
"build:publish": "run-script-os",
6363
"build:publish:darwin": "tsc -p . && electron-builder -p onTagOrDraft -m --x64 --arm64",
6464
"build:publish:win32": "tsc -p . && electron-builder -p onTagOrDraft -w",

0 commit comments

Comments
 (0)