Skip to content

Commit b7ac24e

Browse files
committed
Rework release script to be in ts
1 parent 88f91a2 commit b7ac24e

File tree

7 files changed

+267
-227
lines changed

7 files changed

+267
-227
lines changed

.github/workflows/flatpak.yml

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,82 @@
1-
name: Flatpak Build
1+
# name: Flatpak Build
22

3-
on:
4-
push:
5-
tags:
6-
- 'v*'
7-
workflow_dispatch:
3+
# on:
4+
# push:
5+
# tags:
6+
# - 'v*'
7+
# workflow_dispatch:
88

9-
jobs:
10-
flatpak:
11-
runs-on: ubuntu-latest
12-
container:
13-
image: bilelmoussaoui/flatpak-github-actions:kde-6.5
14-
options: --privileged
15-
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
9+
# jobs:
10+
# flatpak:
11+
# runs-on: ubuntu-latest
12+
# container:
13+
# image: bilelmoussaoui/flatpak-github-actions:kde-6.5
14+
# options: --privileged
15+
# steps:
16+
# - name: Checkout
17+
# uses: actions/checkout@v4
18+
# with:
19+
# fetch-depth: 0
2020

21-
- name: Set up Node.js
22-
uses: actions/setup-node@v4
23-
with:
24-
node-version: '22.x'
25-
cache: 'npm'
21+
# - name: Set up Node.js
22+
# uses: actions/setup-node@v4
23+
# with:
24+
# node-version: '22.x'
25+
# cache: 'npm'
2626

27-
- name: Install dependencies
28-
run: |
29-
npm ci
27+
# - name: Install dependencies
28+
# run: |
29+
# npm ci
3030

31-
- name: Setup Flatpak
32-
run: |
33-
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
34-
flatpak install -y flathub org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08 org.electronjs.Electron2.BaseApp//23.08
31+
# - name: Setup Flatpak
32+
# run: |
33+
# flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
34+
# flatpak install -y flathub org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08 org.electronjs.Electron2.BaseApp//23.08
3535

36-
- name: Add Flatpak manifest
37-
run: |
38-
cat > org.alichtman.deadbolt.yml << 'EOF'
39-
app-id: org.alichtman.deadbolt
40-
runtime: org.freedesktop.Platform
41-
runtime-version: '23.08'
42-
sdk: org.freedesktop.Sdk
43-
base: org.electronjs.Electron2.BaseApp
44-
base-version: '23.08'
45-
command: deadbolt
46-
finish-args:
47-
- --share=ipc
48-
- --socket=x11
49-
- --socket=pulseaudio
50-
- --share=network
51-
- --device=dri
52-
- --filesystem=home
53-
modules:
54-
- name: deadbolt
55-
buildsystem: simple
56-
build-commands:
57-
- cp -r * /app/deadbolt/
58-
- mkdir -p /app/bin
59-
- ln -s /app/deadbolt/deadbolt /app/bin/deadbolt
60-
sources:
61-
- type: dir
62-
path: .
63-
EOF
36+
# - name: Add Flatpak manifest
37+
# run: |
38+
# cat > org.alichtman.deadbolt.yml << 'EOF'
39+
# app-id: org.alichtman.deadbolt
40+
# runtime: org.freedesktop.Platform
41+
# runtime-version: '23.08'
42+
# sdk: org.freedesktop.Sdk
43+
# base: org.electronjs.Electron2.BaseApp
44+
# base-version: '23.08'
45+
# command: deadbolt
46+
# finish-args:
47+
# - --share=ipc
48+
# - --socket=x11
49+
# - --socket=pulseaudio
50+
# - --share=network
51+
# - --device=dri
52+
# - --filesystem=home
53+
# modules:
54+
# - name: deadbolt
55+
# buildsystem: simple
56+
# build-commands:
57+
# - cp -r * /app/deadbolt/
58+
# - mkdir -p /app/bin
59+
# - ln -s /app/deadbolt/deadbolt /app/bin/deadbolt
60+
# sources:
61+
# - type: dir
62+
# path: .
63+
# EOF
6464

65-
- name: Build Flatpak package
66-
run: |
67-
flatpak-builder --repo=repo --force-clean build-dir org.alichtman.deadbolt.yml
68-
flatpak build-bundle repo deadbolt.flatpak org.alichtman.deadbolt
65+
# - name: Build Flatpak package
66+
# run: |
67+
# flatpak-builder --repo=repo --force-clean build-dir org.alichtman.deadbolt.yml
68+
# flatpak build-bundle repo deadbolt.flatpak org.alichtman.deadbolt
6969

70-
- name: Upload Flatpak bundle
71-
uses: actions/upload-artifact@v4
72-
with:
73-
name: flatpak-bundle
74-
path: deadbolt.flatpak
70+
# - name: Upload Flatpak bundle
71+
# uses: actions/upload-artifact@v4
72+
# with:
73+
# name: flatpak-bundle
74+
# path: deadbolt.flatpak
7575

76-
- name: Release
77-
uses: softprops/action-gh-release@v1
78-
if: startsWith(github.ref, 'refs/tags/')
79-
with:
80-
files: deadbolt.flatpak
81-
env:
82-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
76+
# - name: Release
77+
# uses: softprops/action-gh-release@v1
78+
# if: startsWith(github.ref, 'refs/tags/')
79+
# with:
80+
# files: deadbolt.flatpak
81+
# env:
82+
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

.github/workflows/publish.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
name: Publish
1+
# name: Publish
22

3-
on:
4-
push:
5-
tags:
6-
- 'v*'
3+
# on:
4+
# push:
5+
# tags:
6+
# - 'v*'
77

8-
jobs:
9-
publish:
10-
# Values from config in package.json > "build" are used here.
11-
# Can only build all artifacts (win, mac, linux) on macos-latest.
12-
runs-on: ${{ matrix.os }}
8+
# jobs:
9+
# publish:
10+
# # Values from config in package.json > "build" are used here.
11+
# # Can only build all artifacts (win, mac, linux) on macos-latest.
12+
# runs-on: ${{ matrix.os }}
1313

14-
strategy:
15-
matrix:
16-
os: [macos-latest]
14+
# strategy:
15+
# matrix:
16+
# os: [macos-latest]
1717

18-
steps:
19-
- name: Checkout git repo
20-
uses: actions/checkout@v3
18+
# steps:
19+
# - name: Checkout git repo
20+
# uses: actions/checkout@v3
2121

22-
- name: Install Node and NPM
23-
uses: actions/setup-node@v3
24-
with:
25-
node-version: 22
26-
cache: npm
22+
# - name: Install Node and NPM
23+
# uses: actions/setup-node@v3
24+
# with:
25+
# node-version: 22
26+
# cache: npm
2727

28-
- name: Install and build
29-
run: |
30-
npm install
31-
npm run postinstall
32-
npm run build
28+
# - name: Install and build
29+
# run: |
30+
# npm install
31+
# npm run postinstall
32+
# npm run build
3333

34-
- name: Publish releases
35-
env:
36-
# This token is used for uploading release assets to github.
37-
# It has very strict permissions.
38-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
39-
run: |
40-
npm exec electron-builder -- --publish always --win --mac --linux
34+
# - name: Publish releases
35+
# env:
36+
# # This token is used for uploading release assets to github.
37+
# # It has very strict permissions.
38+
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
39+
# run: |
40+
# npm exec electron-builder -- --publish always --win --mac --linux

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"start:preload": "npm run update-versions && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
4747
"start:renderer": "npm run update-versions && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
4848
"test": "jest",
49-
"update-versions": "node scripts/copy-version-from-main-to-app.js"
49+
"update-versions": "ts-node scripts/copy-version-from-main-to-app.ts",
50+
"release": "ts-node scripts/release.ts"
5051
},
5152
"browserslist": [
5253
"extends browserslist-config-erb"
@@ -130,6 +131,7 @@
130131
"@types/react-lottie": "^1.2.10",
131132
"@types/react-test-renderer": "^19.0.0",
132133
"@types/webpack-bundle-analyzer": "^4.7.0",
134+
"@types/which": "^3.0.4",
133135
"@typescript-eslint/eslint-plugin": "^6.7.0",
134136
"@typescript-eslint/parser": "^6.7.0",
135137
"browserslist-config-erb": "^0.0.3",
@@ -202,7 +204,8 @@
202204
"target": {
203205
"target": "dmg",
204206
"arch": [
205-
"universal"
207+
"x64",
208+
"arm64"
206209
]
207210
},
208211
"type": "distribution",

scripts/copy-version-from-main-to-app.js renamed to scripts/copy-version-from-main-to-app.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
/* eslint-disable no-console */
2-
const fs = require('fs');
3-
const path = require('path');
2+
import fs from 'fs';
3+
import path from 'path';
44

5-
const mainPackagePath = path.join(__dirname, '../package.json');
6-
const appPackagePath = path.join(__dirname, '../release/app/package.json');
5+
const mainPackagePath: string = path.join(__dirname, '../package.json');
6+
const appPackagePath: string = path.join(
7+
__dirname,
8+
'../release/app/package.json',
9+
);
710

8-
const mainPackage = JSON.parse(fs.readFileSync(mainPackagePath, 'utf8'));
9-
const appPackage = JSON.parse(fs.readFileSync(appPackagePath, 'utf8'));
11+
const mainPackage: { version: string } = JSON.parse(
12+
fs.readFileSync(mainPackagePath, 'utf8'),
13+
);
14+
const appPackage: { version: string } = JSON.parse(
15+
fs.readFileSync(appPackagePath, 'utf8'),
16+
);
1017

1118
console.log(
1219
`Copying version (${mainPackage.version}) from ${mainPackagePath} to ${appPackagePath}`,

0 commit comments

Comments
 (0)