Skip to content

Commit b790dab

Browse files
authored
Create nighyly release action
1 parent 395cf59 commit b790dab

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

.github/workflows/nighyly.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
2+
name: Nightly Release
3+
on:
4+
# This can be used to automatically publish nightlies at UTC nighttime
5+
schedule:
6+
- cron: '0 2 * * *' # run at 2 AM UTC
7+
# This can be used to allow manually triggering nightlies from the web interface
8+
workflow_dispatch:
9+
10+
jobs:
11+
nightly-electron:
12+
name: Deploy nightly
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
arch: [x64, arm64]
17+
os:
18+
- name: macos
19+
image: macos-latest
20+
extension: dmg
21+
- name: linux
22+
image: ubuntu-latest
23+
extension: deb
24+
- name: windows
25+
image: windows-latest
26+
extension: exe
27+
runs-on: ${{ matrix.os.image }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Set up node & dependencies
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: 20
34+
- name: Set up Python for appdmg to be installed
35+
if: ${{ matrix.os.name == 'macos' }}
36+
run: brew install python-setuptools
37+
- name: Install dependencies
38+
run: npm ci
39+
- name: Update build info
40+
run: npm run update-build-info
41+
- name: Run electron-forge
42+
run: npm run make-electron -- --arch=${{ matrix.arch }}
43+
- name: Prepare artifacts (Unix)
44+
if: runner.os != 'windows'
45+
run: |
46+
mkdir -p upload
47+
file=$(find out/make -name '*.zip' -print -quit)
48+
cp "$file" "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.zip"
49+
file=$(find out/make -name '*.${{ matrix.os.extension }}' -print -quit)
50+
cp "$file" "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.${{ matrix.os.extension }}"
51+
- name: Prepare artifacts (Windows)
52+
if: runner.os == 'windows'
53+
run: |
54+
mkdir upload
55+
$file = Get-ChildItem -Path out/make -Filter '*.zip' -Recurse | Select-Object -First 1
56+
Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.zip"
57+
$file = Get-ChildItem -Path out/make -Filter '*.${{ matrix.os.extension }}' -Recurse | Select-Object -First 1
58+
Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.${{ matrix.os.extension }}"
59+
- name: Publish artifacts
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: TriliumNextNotes ${{ matrix.os.name }} ${{ matrix.arch }}
63+
path: upload/*.zip
64+
overwrite: true
65+
- name: Publish installer artifacts
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: TriliumNextNotes ${{ matrix.os.name }} ${{ matrix.arch }}
69+
path: upload/*.${{ matrix.os.extension }}
70+
overwrite: true
71+
72+
- name: Deploy release
73+
uses: WebFreak001/deploy-nightly@v3.1.0
74+
with:
75+
# upload_url: # find out this value by opening https://api.github.com/repos/<owner>/<repo>/releases in your browser and copy the full "upload_url" value including the {?name,label} part
76+
# release_id: # same as above (id can just be taken out the upload_url, it's used to find old releases)
77+
asset_path: upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.zip # path to archive to upload
78+
asset_name: TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}-nightly.zip # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
79+
asset_content_type: application/zip # required by GitHub API
80+
- name: Deploy installer release
81+
uses: WebFreak001/deploy-nightly@v3.1.0
82+
with:
83+
# upload_url: # find out this value by opening https://api.github.com/repos/<owner>/<repo>/releases in your browser and copy the full "upload_url" value including the {?name,label} part
84+
# release_id: # same as above (id can just be taken out the upload_url, it's used to find old releases)
85+
asset_path: upload/TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}.${{ matrix.os.extension }} # path to archive to upload
86+
asset_name: TriliumNextNotes-${{ matrix.os.name }}-${{ matrix.arch }}-nightly.${{ matrix.os.extension }} # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
87+
asset_content_type: application/zip # required by GitHub API
88+
nightly-server:
89+
name: Deploy server nightly
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v4
93+
- name: Set up node & dependencies
94+
uses: actions/setup-node@v4
95+
with:
96+
node-version: 20
97+
cache: "npm"
98+
- name: Install dependencies
99+
run: npm ci
100+
- name: Run Linux server build (x86_64)
101+
run: |
102+
npm run update-build-info
103+
./bin/build-server.sh
104+
- name: Prepare artifacts
105+
if: runner.os != 'windows'
106+
run: |
107+
mkdir -p upload
108+
file=$(find dist -name '*.tar.xz' -print -quit)
109+
cp "$file" "upload/TriliumNextNotes-linux-x64-${{ github.ref_name }}.tar.xz"
110+
- uses: actions/upload-artifact@v4
111+
with:
112+
name: TriliumNextNotes linux server x64
113+
path: upload/TriliumNextNotes-linux-x64-${{ github.ref_name }}.tar.xz
114+
overwrite: true
115+
116+
- name: Deploy release
117+
uses: WebFreak001/deploy-nightly@v3.1.0
118+
with:
119+
# upload_url: # find out this value by opening https://api.github.com/repos/<owner>/<repo>/releases in your browser and copy the full "upload_url" value including the {?name,label} part
120+
# release_id: # same as above (id can just be taken out the upload_url, it's used to find old releases)
121+
asset_path: upload/TriliumNextNotes-linux-x64-${{ github.ref_name }}.tar.xz # path to archive to upload
122+
asset_name: TriliumNextNotes-linux-x64-nightly.zip # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
123+
asset_content_type: application/zip # required by GitHub API

0 commit comments

Comments
 (0)