This repository has been archived by the owner on Dec 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
142 lines (119 loc) · 4.37 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Build/release
on:
push:
paths-ignore:
- 'docs/**'
pull_request:
paths-ignore:
- 'docs/**'
workflow_dispatch:
jobs:
version_checker:
runs-on: ubuntu-latest
outputs:
VERSION_MATCH: ${{ steps.compare-versions.outputs.VERSION_MATCH }}
# permissions:
# contents: write
# pull-requests: write
# repository-projects: write
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read package version
uses: ZvonimirSun/read-package-version-actions@v2
id: package-version
- name: Get Latest Release Version
id: get-latest-release
uses: pozetroninc/github-action-get-latest-release@v0.8.0
with:
repository: ${{ github.repository }}
# token: ${{ secrets.GITHUB_TOKEN }}
# excludes: draft
# uses: InsonusK/get-latest-release@v1.1.0
# with:
# myToken: ${{ secrets.GITHUB_TOKEN }}
# exclude_types: 'draft'
- name: Compare versions and increment if needed
id: compare-versions
run: |
PACKAGE_VERSION="${{ steps.package-version.outputs.version }}"
GITHUB_RELEASE_VERSION="${{ steps.get-latest-release.outputs.release }}"
# Strip leading 'v' if present
GITHUB_RELEASE_VERSION="${GITHUB_RELEASE_VERSION#v}"
echo "Package version: $PACKAGE_VERSION"
echo "GitHub release version: $GITHUB_RELEASE_VERSION"
if [ "$PACKAGE_VERSION" = "$GITHUB_RELEASE_VERSION" ]; then
VERSION_MATCH=true
else
VERSION_MATCH=false
fi
echo "Versions are equal: $VERSION_MATCH"
echo "VERSION_MATCH=${VERSION_MATCH}" >> $GITHUB_ENV
echo "VERSION_MATCH=${VERSION_MATCH}" >> $GITHUB_OUTPUT
exit 0
- name: Create a pull request with version bump if needed
if: ${{ steps.compare-versions.outputs.VERSION_MATCH == 'true' }}
uses: r7kamura/bump-request@v0.5.0
with:
release_type: 'patch'
release:
needs: version_checker
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Setup target Node.js to enable Corepack
uses: actions/setup-node@v4
with:
node-version: 22
- run: |
corepack enable
yarn -v
if: ${{ needs.version_checker.outputs.VERSION_MATCH == 'false' }}
- name: Check out Git repository
uses: actions/checkout@v4
if: ${{ needs.version_checker.outputs.VERSION_MATCH == 'false' }}
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v4
if: ${{ needs.version_checker.outputs.VERSION_MATCH == 'false' }}
with:
node-version: 22
cache: 'yarn'
- run: |
yarn -v
if: ${{ needs.version_checker.outputs.VERSION_MATCH == 'false' }}
# - uses: actions/setup-python@v5
# if: ${{ needs.version_checker.outputs.VERSION_MATCH == 'false' }}
# with:
# python-version: '3.9'
# - run: |
# pip install setuptools
# if: ${{ needs.version_checker.outputs.VERSION_MATCH == 'false' }}
# - name: Install dependencies on Ubuntu
# if: matrix.os == 'ubuntu-latest'
# run: sudo apt-get update && sudo apt-get install libsdl-pango-dev
# - name: Install dependencies on macOS
# if: matrix.os == 'macos-latest'
# run: brew install pkg-config cairo pango libpng jpeg giflib
- run: |
yarn install
if: ${{ needs.version_checker.outputs.VERSION_MATCH == 'false' }}
- name: Build and Publish Electron App
run: yarn build
if: ${{ needs.version_checker.outputs.VERSION_MATCH == 'false' }}
env:
GITHUB_TOKEN: ${{ github.token }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Upload artifacts
if: ${{ needs.version_checker.outputs.VERSION_MATCH == 'false' }}
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.os }}
path: |
dist/electron/Packaged/*.exe
dist/electron/UnPackaged/node_modules/@electron/remote/package.json
dist/electron/Packaged/*.dmg
dist/electron/Packaged/*.AppImage