@@ -3,54 +3,183 @@ name: Release App
33permissions :
44 contents : write
55
6+ env :
7+ PRODUCT_NAME : ' Deditor'
8+ BUNDLE_NAME : ' '
9+
610on :
711 release :
812 types :
913 - prereleased
14+ workflow_dispatch :
15+ inputs :
16+ build_only :
17+ description : Build only
18+ required : false
19+ default : false
20+ type : boolean
21+ artifacts_only :
22+ description : Build and upload artifacts only
23+ required : false
24+ default : false
25+ type : boolean
26+ tag :
27+ description : Specific tag/commit for the release (leave empty to auto-detect latest tag)
28+ required : false
29+ type : string
30+ schedule :
31+ - cron : ' 0 0 * * *'
1032
1133jobs :
1234 build :
1335 name : Build
1436 strategy :
1537 matrix :
1638 include :
39+
1740 - os : macos-13
1841 artifact : darwin-x64
42+ target : x86_64-apple-darwin
43+ builder-args : --macos --x64
1944 ext : dmg
45+
2046 - os : macos-latest
2147 artifact : darwin-arm64
48+ target : aarch64-apple-darwin
49+ builder-args : --macos --arm64
2250 ext : dmg
51+
2352 - os : ubuntu-latest
2453 artifact : linux-x64
54+ target : x86_64-unknown-linux-gnu
55+ builder-args : --linux --x64
2556 ext : AppImage
26- # - os: ubuntu-24.04-arm
27- # artifact: linux-arm64
28- # ext: AppImage
57+
58+ - os : ubuntu-24.04-arm
59+ artifact : linux-arm64
60+ target : aarch64-unknown-linux-gnu
61+ builder-args : --linux --arm64
62+ ext : AppImage
63+
2964 - os : windows-latest
3065 artifact : windows-x64-setup
66+ target : x86_64-pc-windows-msvc
67+ builder-args : --windows --x64
3168 ext : exe
69+
3270 runs-on : ${{ matrix.os }}
3371 steps :
34- - uses : actions/checkout@v4
72+ # Why?
73+ #
74+ # failed to build archive at `/home/runner/work/deditor/deditor/target/x86_64-unknown-linux-gnu/release/deps/libapp_lib.rlib`:
75+ # No space left on device (os error 28)
76+ - name : Free Disk Space
77+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
78+ uses : jlumbroso/free-disk-space@main
79+
80+ - uses : actions/checkout@v5
3581 - uses : pnpm/action-setup@v4
3682 with :
3783 run_install : false
38- - uses : actions/setup-node@v4
84+ - uses : actions/setup-node@v5
3985 with :
4086 node-version : lts/*
4187 cache : pnpm
4288 - run : pnpm install --frozen-lockfile
43- - name : Build
89+
90+ # ---------
91+ # Build
92+ # ---------
93+
94+ - run : pnpm run build:packages
95+
96+ - name : Build (Windows Only) # Windows
97+ if : matrix.os == 'windows-latest'
98+ run : pnpm run -F @deditor-app/deditor build && pnpm -F @deditor-app/deditor exec electron-builder build ${{ matrix.builder-args }}
99+
100+ - name : Build (macOS Only) # macOS
101+ if : matrix.os == 'macos-13' || matrix.os == 'macos-latest'
102+ run : pnpm run -F @deditor-app/deditor build && pnpm -F @deditor-app/deditor exec electron-builder build ${{ matrix.builder-args }}
103+
104+ - name : Build (Linux Only) # Linux
105+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
106+ run : pnpm run -F @deditor-app/deditor build && pnpm -F @deditor-app/deditor exec electron-builder build ${{ matrix.builder-args }}
107+
108+ # ---------
109+ # Nightly (schedule) builds only
110+ # ---------
111+ - name : Get Name of Artifacts (Nightly + Windows Only)
112+ if : ${{ github.event_name == 'schedule' && matrix.os == 'windows-latest' }}
113+ run : |
114+ pnpm -F @deditor-app/deditor name-of-artifacts ${{ matrix.target }} --out bundle_name
115+ echo "BUNDLE_NAME=$(node -p "require('node:fs').readFileSync(require('node:path').join('apps', 'deditor', 'bundle_name')).toString('utf-8')")" >> $env:GITHUB_ENV
116+
117+ - name : Get Name of Artifacts (Nightly)
118+ if : ${{ github.event_name == 'schedule' && matrix.os != 'windows-latest' }}
44119 run : |
45- pnpm run build:packages
46- pnpm run build:electron
120+ pnpm -F @deditor-app/deditor name-of-artifacts ${{ matrix.target }} --out bundle_name
121+ echo "BUNDLE_NAME=$(node -p "require('node:fs').readFileSync(require('node:path').join('apps', 'deditor', 'bundle_name')).toString('utf-8')")" >> $GITHUB_ENV
122+
123+ - name : Rename Artifacts (Nightly)
124+ if : ${{ github.event_name == 'schedule' }}
125+ run :
126+ pnpm run -F @deditor-app/deditor rename-artifacts ${{ matrix.target }}
127+
128+ - name : Upload Artifacts (Nightly)
129+ if : ${{ github.event_name == 'schedule' }}
130+ uses : actions/upload-artifact@v4
131+ with :
132+ name : ${{ env.BUNDLE_NAME }}
133+ path : apps/deditor/bundle/${{ env.BUNDLE_NAME }}
134+
135+ # ---------
136+ # Workflow Dispatch only
137+ # ---------
138+
139+ - name : Get Name of Artifacts (Manual + Windows Only)
140+ if : ${{ github.event_name == 'workflow_dispatch' && matrix.os == 'windows-latest' }}
141+ run : |
142+ pnpm -F @deditor-app/deditor name-of-artifacts ${{ matrix.target }} --out bundle_name --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }}
143+ echo "BUNDLE_NAME=$(node -p "require('node:fs').readFileSync(require('node:path').join('apps', 'deditor', 'bundle_name')).toString('utf-8')")" >> $env:GITHUB_ENV
144+
145+ - name : Get Name of Artifacts (Manual)
146+ if : ${{ github.event_name == 'workflow_dispatch' && matrix.os != 'windows-latest' }}
147+ run : |
148+ pnpm -F @deditor-app/deditor name-of-artifacts ${{ matrix.target }} --out bundle_name --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }}
149+ echo "BUNDLE_NAME=$(node -p "require('node:fs').readFileSync(require('node:path').join('apps', 'deditor', 'bundle_name')).toString('utf-8')")" >> $GITHUB_ENV
150+
151+ - name : Rename Artifacts (Manual)
152+ if : ${{ github.event_name == 'workflow_dispatch' }}
153+ run : |
154+ pnpm run -F @deditor-app/deditor rename-artifacts ${{ matrix.target }} --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }}
155+
156+ - name : Upload Artifacts (Manual + Non-Release)
157+ if : ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && inputs.artifacts_only }}
158+ uses : actions/upload-artifact@v4
159+ with :
160+ name : ${{ env.BUNDLE_NAME }}
161+ path : apps/deditor/bundle/${{ env.BUNDLE_NAME }}
162+
163+ - name : Upload To GitHub Releases (Manual + Overwrite Release)
164+ if : ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && !inputs.artifacts_only }}
165+ uses : softprops/action-gh-release@v2
166+ with :
167+ files : apps/deditor/bundle/${{ env.PRODUCT_NAME }}_*
168+ append_body : true
169+ tag_name : ${{ inputs.tag }}
170+
171+ # ---------
172+ # Version push
173+ # ---------
47174
48- - id : version
175+ - name : Rename Artifacts (Automatic)
176+ if : ${{ github.event_name == 'release' }}
49177 run : |
50- echo VERSION=$( pnpm exec tsx scripts/get-package-json-version.ts) >> $GITHUB_ENV
178+ pnpm run -F @deditor-app/deditor rename-artifacts ${{ matrix.target }} --release --auto-tag
51179
52- - name : Upload To GitHub Releases
180+ - name : Upload To GitHub Releases (Automatic)
181+ if : ${{ github.event_name == 'release' }}
53182 uses : softprops/action-gh-release@v2
54183 with :
55- files : dist/Deditor-v ${{ steps.version.outputs.VERSION }}-${{ matrix.artifact }}.${{ matrix.ext }}
56- generate_release_notes : true
184+ files : apps/deditor/bundle/ ${{ env.PRODUCT_NAME }}_*
185+ append_body : true
0 commit comments