WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit a7d492e

Browse files
authored
Add GitHub Actions workflow to build TiddlyDesktop (#289)
* Add GitHub Actions workflow to build TiddlyDesktop * Build in parallel so it takes one-sixth as long * Add release workflow Creates draft releases so they can be edited (adding release notes, for example) before they become visible to the public.
1 parent 8a0c4e0 commit a7d492e

File tree

5 files changed

+258
-13
lines changed

5 files changed

+258
-13
lines changed

.github/workflows/ci.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Build and package TiddlyDesktop
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- 'v[0-9]+.[0-9]+.[0-9]+'
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
build-and-package:
15+
strategy:
16+
matrix:
17+
include:
18+
- platform: linux
19+
arch: x64
20+
ext: tar.gz
21+
platform-for-pkg: linux64
22+
runs-on: ubuntu-latest
23+
- platform: linux
24+
arch: ia32
25+
ext: tar.gz
26+
platform-for-pkg: linux32
27+
runs-on: ubuntu-latest
28+
- platform: win
29+
arch: x64
30+
ext: zip
31+
platform-for-pkg: win64
32+
runs-on: ubuntu-latest
33+
- platform: win
34+
arch: ia32
35+
ext: zip
36+
platform-for-pkg: win32
37+
runs-on: ubuntu-latest
38+
- platform: osx
39+
arch: x64
40+
ext: zip
41+
platform-for-pkg: mac64
42+
runs-on: macos-latest
43+
- platform: osx
44+
arch: arm64
45+
ext: zip
46+
platform-for-pkg: macapplesilicon
47+
runs-on: macos-latest
48+
runs-on: ${{ matrix.runs-on }}
49+
name: "Build ${{ matrix.platform-for-pkg }}"
50+
steps:
51+
- name: "💾 Checking out repository code..."
52+
uses: actions/checkout@v4
53+
- name: "🔭 Looking up TiddlyDesktop version..."
54+
id: td-version
55+
run: |
56+
TD_VERSION=$(bin/get-version-number)
57+
echo "TiddlyDesktop version: $TD_VERSION"
58+
echo "version=$TD_VERSION" >> "$GITHUB_OUTPUT"
59+
- name: "🧮 Calculating nw.js version..."
60+
id: calc-version
61+
run: |
62+
NWJS_VERSION=$(<nwjs-version.txt)
63+
[ -n "$NWJS_VERSION" ] && echo "nw.js version: $NWJS_VERSION" || echo "No nwjs-version.txt file found!"
64+
[ -n "$NWJS_VERSION" ] && echo "nwjs-version=$NWJS_VERSION" >> "$GITHUB_OUTPUT"
65+
- name: "🗃️ Setting up caching for nw.js..."
66+
id: nwjs-cache
67+
uses: actions/cache@v4
68+
with:
69+
path: nwjs
70+
key: nwjs-${{ matrix.platform }}-${{ matrix.arch }}-${{ steps.calc-version.outputs.nwjs-version }}
71+
- name: "🛝 Downloading nw.js..."
72+
if: ${{ steps.nwjs-cache.outputs.cache-hit != 'true' }}
73+
run: ./download-nwjs.sh
74+
env:
75+
NWJS_VERSION: ${{ steps.calc-version.outputs.nwjs-version }}
76+
PLATFORM: ${{ matrix.platform }}
77+
ARCH: ${{ matrix.arch }}
78+
EXT: ${{ matrix.ext }}
79+
- name: "🛠️ Building TiddlyDesktop..."
80+
run: ./bld.sh
81+
env:
82+
NWJS_VERSION: ${{ steps.calc-version.outputs.nwjs-version }}
83+
PLATFORM: ${{ matrix.platform }}
84+
ARCH: ${{ matrix.arch }}
85+
- name: "📦 Packaging TiddlyDesktop..."
86+
run: ./package.sh
87+
env:
88+
PLATFORM: ${{ matrix.platform }}
89+
ARCH: ${{ matrix.arch }}
90+
- name: "📤 Uploading packages..."
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.zip
94+
path: output/tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.zip
95+
outputs:
96+
td-version: ${{ steps.td-version.outputs.version }}
97+
98+
release:
99+
# Run only if a tag was pushed (tag filter in workflow guarantees the only tags we'll see are ones that look like v1.2.3)
100+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
101+
# Run only after build-and-package job completes
102+
needs: build-and-package
103+
# This job does *not* have a matrix so it runs only a single copy
104+
runs-on: ubuntu-latest
105+
steps:
106+
- name: "📥 Downloading packages..."
107+
uses: actions/download-artifact@v4
108+
with:
109+
# merge-multiple: true means that all built files will end up in the workspace directory
110+
# If it was false, they would all be given their own separate directories, which is not convenient for the release step
111+
merge-multiple: true
112+
- name: "🚀 Creating release..."
113+
uses: softprops/action-gh-release@v1
114+
with:
115+
draft: true
116+
files: |
117+
tiddlydesktop-*-v${{ needs.build-and-package.outputs.td-version }}.zip

bld.sh

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,20 @@ mkdir -p output/linux64/TiddlyDesktop-linux64-v$(./bin/get-version-number)
3535

3636
# For each platform, copy the stock nw.js binaries overlaying the "source" directory (and icons and plist for the Mac)
3737

38+
# Calculate nw.js version
39+
40+
if [ $# -gt 0 ]; then
41+
NWJS_VERSION=$1
42+
elif [ -z "$NWJS_VERSION" ]; then
43+
NWJS_VERSION=0.77.0
44+
fi
45+
46+
# Build function definitions (which will be called at the end of the script)
47+
3848
# OS X 64-bit App
49+
build_mac64() {
3950

40-
cp -RH nwjs/nwjs-sdk-v0.77.0-osx-x64/nwjs.app output/mac64/TiddlyDesktop-mac64-v$(./bin/get-version-number)/TiddlyDesktop.app
51+
cp -RH nwjs/nwjs-sdk-v${NWJS_VERSION}-osx-x64/nwjs.app output/mac64/TiddlyDesktop-mac64-v$(./bin/get-version-number)/TiddlyDesktop.app
4152
cp -RH source output/mac64/TiddlyDesktop-mac64-v$(./bin/get-version-number)/TiddlyDesktop.app/Contents/Resources/app.nw
4253
cp icons/app.icns output/mac64/TiddlyDesktop-mac64-v$(./bin/get-version-number)/TiddlyDesktop.app/Contents/Resources/nw.icns
4354
cp Info.plist output/mac64/TiddlyDesktop-mac64-v$(./bin/get-version-number)/TiddlyDesktop.app/Contents/Info.plist
@@ -47,9 +58,12 @@ do
4758
cp "./strings/InfoPlist.strings" "$f/InfoPlist.strings"
4859
done
4960

61+
}
62+
5063
# OS X Apple Silicon App
64+
build_macapplesilicon() {
5165

52-
cp -RH nwjs/nwjs-sdk-v0.77.0-osx-arm64/nwjs.app output/macapplesilicon/TiddlyDesktop-macapplesilicon-v$(./bin/get-version-number)/TiddlyDesktop.app
66+
cp -RH nwjs/nwjs-sdk-v${NWJS_VERSION}-osx-arm64/nwjs.app output/macapplesilicon/TiddlyDesktop-macapplesilicon-v$(./bin/get-version-number)/TiddlyDesktop.app
5367
cp -RH source output/macapplesilicon/TiddlyDesktop-macapplesilicon-v$(./bin/get-version-number)/TiddlyDesktop.app/Contents/Resources/app.nw
5468
cp icons/app.icns output/macapplesilicon/TiddlyDesktop-macapplesilicon-v$(./bin/get-version-number)/TiddlyDesktop.app/Contents/Resources/nw.icns
5569
cp Info.plist output/macapplesilicon/TiddlyDesktop-macapplesilicon-v$(./bin/get-version-number)/TiddlyDesktop.app/Contents/Info.plist
@@ -61,18 +75,60 @@ done
6175

6276
xattr -c output/macapplesilicon/TiddlyDesktop-macapplesilicon-v$(./bin/get-version-number)/TiddlyDesktop.app
6377

78+
}
79+
6480
# Windows 64-bit App
65-
cp -RH nwjs/nwjs-sdk-v0.77.0-win-x64/* output/win64/TiddlyDesktop-win64-v$(./bin/get-version-number)
81+
build_win64() {
82+
cp -RH nwjs/nwjs-sdk-v${NWJS_VERSION}-win-x64/* output/win64/TiddlyDesktop-win64-v$(./bin/get-version-number)
6683
cp -RH source/* output/win64/TiddlyDesktop-win64-v$(./bin/get-version-number)
84+
}
6785

6886
# # Windows 32-bit App
69-
cp -RH nwjs/nwjs-sdk-v0.77.0-win-ia32/* output/win32/TiddlyDesktop-win32-v$(./bin/get-version-number)
87+
build_win32() {
88+
cp -RH nwjs/nwjs-sdk-v${NWJS_VERSION}-win-ia32/* output/win32/TiddlyDesktop-win32-v$(./bin/get-version-number)
7089
cp -RH source/* output/win32/TiddlyDesktop-win32-v$(./bin/get-version-number)
90+
}
7191

7292
# # Linux 64-bit App
73-
cp -RH nwjs/nwjs-sdk-v0.77.0-linux-x64/* output/linux64/TiddlyDesktop-linux64-v$(./bin/get-version-number)
93+
build_linux64() {
94+
cp -RH nwjs/nwjs-sdk-v${NWJS_VERSION}-linux-x64/* output/linux64/TiddlyDesktop-linux64-v$(./bin/get-version-number)
7495
cp -RH source/* output/linux64/TiddlyDesktop-linux64-v$(./bin/get-version-number)
96+
}
7597

7698
# # Linux 32-bit App
77-
cp -RH nwjs/nwjs-sdk-v0.77.0-linux-ia32/* output/linux32/TiddlyDesktop-linux32-v$(./bin/get-version-number)
99+
build_linux32() {
100+
cp -RH nwjs/nwjs-sdk-v${NWJS_VERSION}-linux-ia32/* output/linux32/TiddlyDesktop-linux32-v$(./bin/get-version-number)
78101
cp -RH source/* output/linux32/TiddlyDesktop-linux32-v$(./bin/get-version-number)
102+
}
103+
104+
if [ "$CI" = "true" ]; then
105+
# Running in GitHub Actions, where each platform builds as a separate step, in parallel, with PLATFORM and ARCH variables supplied by the GitHub Actions script
106+
case "$PLATFORM-$ARCH" in
107+
osx-x64)
108+
build_mac64
109+
;;
110+
osx-arm64)
111+
build_macapplesilicon
112+
;;
113+
win-ia32)
114+
build_win32
115+
;;
116+
win-x64)
117+
build_win64
118+
;;
119+
linux-ia32)
120+
build_linux32
121+
;;
122+
linux-x64)
123+
build_linux64
124+
;;
125+
esac
126+
else
127+
# Running at the command line, where each platfom builds one at a time in sequence
128+
build_mac64
129+
build_macapplesilicon
130+
build_win32
131+
build_win64
132+
build_linux32
133+
build_linux64
134+
fi

download-nwjs.sh

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,39 @@
44

55
[[ -d ./nwjs ]] || mkdir ./nwjs || exit 1
66

7+
# Set default nw.js version if not specified in environment variable or parameter
8+
9+
if [ $# -gt 0 ]; then
10+
NWJS_VERSION=$1
11+
elif [ -z "$NWJS_VERSION" ]; then
12+
NWJS_VERSION=0.77.0
13+
fi
14+
715
# Download nw.js
816

9-
curl --output 'nwjs/nwjs-sdk-v0.77.0-win-x64.zip' 'https://dl.nwjs.io/v0.77.0/nwjs-sdk-v0.77.0-win-x64.zip' || exit 1
10-
curl --output 'nwjs/nwjs-sdk-v0.77.0-win-ia32.zip' 'https://dl.nwjs.io/v0.77.0/nwjs-sdk-v0.77.0-win-ia32.zip' || exit 1
11-
curl --output 'nwjs/nwjs-sdk-v0.77.0-linux-x64.tar.gz' 'https://dl.nwjs.io/v0.77.0/nwjs-sdk-v0.77.0-linux-x64.tar.gz' || exit 1
12-
curl --output 'nwjs/nwjs-sdk-v0.77.0-linux-ia32.tar.gz' 'https://dl.nwjs.io/v0.77.0/nwjs-sdk-v0.77.0-linux-ia32.tar.gz' || exit 1
13-
curl --output 'nwjs/nwjs-sdk-v0.77.0-osx-x64.zip' 'https://dl.nwjs.io/v0.77.0/nwjs-sdk-v0.77.0-osx-x64.zip' || exit 1
14-
curl --output 'nwjs/nwjs-sdk-v0.77.0-osx-arm64.zip' 'https://dl.nwjs.io/v0.77.0/nwjs-sdk-v0.77.0-osx-arm64.zip' || exit 1
17+
if [ "$CI" = "true" ]; then
18+
# Running in GitHub Actions, where each platform builds as a separate step, in parallel, with PLATFORM and ARCH and EXT variables supplied by the GitHub Actions script
19+
curl --output "nwjs/nwjs-sdk-v${NWJS_VERSION}-${PLATFORM}-${ARCH}.${EXT}" "https://dl.nwjs.io/v${NWJS_VERSION}/nwjs-sdk-v${NWJS_VERSION}-${PLATFORM}-${ARCH}.${EXT}" || exit 1
20+
else
21+
# Running at the command line, where each platfom builds one at a time in sequence
22+
curl --output "nwjs/nwjs-sdk-v${NWJS_VERSION}-win-x64.zip" "https://dl.nwjs.io/v${NWJS_VERSION}/nwjs-sdk-v${NWJS_VERSION}-win-x64.zip" || exit 1
23+
curl --output "nwjs/nwjs-sdk-v${NWJS_VERSION}-win-ia32.zip" "https://dl.nwjs.io/v${NWJS_VERSION}/nwjs-sdk-v${NWJS_VERSION}-win-ia32.zip" || exit 1
24+
curl --output "nwjs/nwjs-sdk-v${NWJS_VERSION}-linux-x64.tar.gz" "https://dl.nwjs.io/v${NWJS_VERSION}/nwjs-sdk-v${NWJS_VERSION}-linux-x64.tar.gz" || exit 1
25+
curl --output "nwjs/nwjs-sdk-v${NWJS_VERSION}-linux-ia32.tar.gz" "https://dl.nwjs.io/v${NWJS_VERSION}/nwjs-sdk-v${NWJS_VERSION}-linux-ia32.tar.gz" || exit 1
26+
curl --output "nwjs/nwjs-sdk-v${NWJS_VERSION}-osx-x64.zip" "https://dl.nwjs.io/v${NWJS_VERSION}/nwjs-sdk-v${NWJS_VERSION}-osx-x64.zip" || exit 1
27+
curl --output "nwjs/nwjs-sdk-v${NWJS_VERSION}-osx-arm64.zip" "https://dl.nwjs.io/v${NWJS_VERSION}/nwjs-sdk-v${NWJS_VERSION}-osx-arm64.zip" || exit 1
28+
fi
1529

1630
pushd nwjs
1731

32+
if [ ".$EXT" = ".tar.gz" ]; then
33+
ls *.gz | xargs -n 1 tar -xvzf || exit 1
34+
elif [ ".$EXT" = ".zip" ]; then
35+
ls *.zip | xargs -n 1 unzip || exit 1
36+
else
37+
# Running at command line, not in GitHub Actions
1838
ls *.gz | xargs -n 1 tar -xvzf || exit 1
1939
ls *.zip | xargs -n 1 unzip || exit 1
40+
fi
2041

2142
popd

nwjs-version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.77.0

package.sh

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,72 @@
77
VERSION=$(./bin/get-version-number)
88

99
# Zip them up
10+
package_win32() {
1011
pushd ./output/win32
1112
zip -r "../tiddlydesktop-win32-v$VERSION.zip" *
1213
popd
14+
}
15+
16+
package_win64() {
1317
pushd ./output/win64
1418
zip -r "../tiddlydesktop-win64-v$VERSION.zip" *
1519
popd
20+
}
21+
22+
package_mac64() {
1623
pushd ./output/mac64
1724
zip --symlinks -r "../tiddlydesktop-mac64-v$VERSION.zip" *
1825
popd
26+
}
27+
28+
package_macapplesilicon() {
1929
pushd ./output/macapplesilicon
20-
sudo xattr -rc "./TiddlyDesktop-macapplesilicon-v$VERSION/TiddlyDesktop.app" && sudo codesign --force --deep --sign - "./TiddlyDesktop-macapplesilicon-v$VERSION/TiddlyDesktop.app"
30+
sudo xattr -rc "./TiddlyDesktop-macapplesilicon-v$VERSION/TiddlyDesktop.app" -a sudo codesign --force --deep --sign - "./TiddlyDesktop-macapplesilicon-v$VERSION/TiddlyDesktop.app"
2131
zip --symlinks -r "../tiddlydesktop-macapplesilicon-v$VERSION.zip" *
2232
popd
33+
}
34+
35+
package_linux32() {
2336
pushd ./output/linux32
2437
zip -r "../tiddlydesktop-linux32-v$VERSION.zip" *
2538
popd
39+
}
40+
41+
package_linux64() {
2642
pushd ./output/linux64
2743
zip -r "../tiddlydesktop-linux64-v$VERSION.zip" *
2844
popd
45+
}
46+
47+
48+
if [ "$CI" = "true" ]; then
49+
# Running in GitHub Actions, where each platform builds as a separate step, in parallel, with PLATFORM and ARCH variables supplied by the GitHub Actions script
50+
case "$PLATFORM-$ARCH" in
51+
osx-x64)
52+
package_mac64
53+
;;
54+
osx-arm64)
55+
package_macapplesilicon
56+
;;
57+
win-ia32)
58+
package_win32
59+
;;
60+
win-x64)
61+
package_win64
62+
;;
63+
linux-ia32)
64+
package_linux32
65+
;;
66+
linux-x64)
67+
package_linux64
68+
;;
69+
esac
70+
else
71+
# Running at the command line, where each platfom builds one at a time in sequence
72+
package_mac64
73+
package_macapplesilicon
74+
package_win32
75+
package_win64
76+
package_linux32
77+
package_linux64
78+
fi

0 commit comments

Comments
 (0)