-
Notifications
You must be signed in to change notification settings - Fork 5
198 lines (176 loc) · 7.46 KB
/
release.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: "publish"
on:
workflow_dispatch:
push:
branches: [master]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
EMAIL: [email protected]
ARCH: x86_64
jobs:
setup:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
arch: ${{ env.ARCH }}
email: ${{ env.EMAIL }}
name: ${{ steps.get-package.outputs.name }}
name-bin: ${{ steps.get-package.outputs.name }}-bin
version: ${{ steps.get-package.outputs.version }}
description: ${{ steps.get-package.outputs.description }}
license: ${{ steps.get-package.outputs.license }}
deb-pkg-name: ${{ steps.get-package.outputs.name }}_${{ steps.get-package.outputs.version }}_amd64.deb
deb-pkg-path: ./src-tauri/target/release/bundle/deb/
tag-exists: ${{ steps.get-package.outputs.tag_exists }}
steps:
- uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: get package info
id: get-package
run: |
echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
echo "description=$(node -p "require('./package.json').description")" >> $GITHUB_OUTPUT
- uses: mukunku/[email protected]
id: checkTag
with:
tag: '${{ steps.get-package.outputs.version }}'
- name: set tag
run: |
echo "tag_exists=${{ steps.checkTag.outputs.exists }}" >> $GITHUB_OUTPUT
# - uses: dev-drprasad/[email protected]
# with:
# tag_name: ${{ steps.get-package.outputs.version }}
# github_token: ${{ secrets.GITHUB_TOKEN }}
build-tauri:
if: ${{ needs.setup.outputs.tag-exists }} == 'false'
needs: [setup]
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
env:
BIN_PATH: ${{ needs.setup.outputs.name-bin }}
DESCRIPTION: ${{ needs.setup.outputs.description }}
LICENSE: ${{ needs.setup.outputs.license }}
DEB_PKG_NAME: ${{ needs.setup.outputs.deb-pkg-name }}
DEB_PKG_PATH: ${{ needs.setup.outputs.deb-pkg-path }}
DEB_PKG_RENAMED: ${{ needs.setup.outputs.name }}-${{ needs.setup.outputs.version }}-${{ needs.setup.outputs.arch }}.deb # leave as is it needs to be renamed for the arch build
ARCH_PKG_NAME: ${{ needs.setup.outputs.name-bin }}-${{ needs.setup.outputs.version }}-1-${{ needs.setup.outputs.arch }}.pkg.tar.zst
RPM_PKG_NAME: ${{ needs.setup.outputs.name }}-${{ needs.setup.outputs.version }}-1.${{ needs.setup.outputs.arch }}.rpm
PACKAGE_VERSION: ${{ needs.setup.outputs.version }}
PACKAGE_NAME: ${{ needs.setup.outputs.name }}
steps:
- uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: install rust stable
uses: dtolnay/rust-toolchain@stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
sudo apt-get install -y openssl
sudo apt-get install -y sudo
sudo apt-get install -y make
sudo apt-get install -y alien
sudo apt-get install -y libgtk-3-dev
sudo apt-get install -y libwebkit2gtk-4.0-dev
sudo apt-get install -y libappindicator3-dev
sudo apt-get install -y librsvg2-dev
sudo apt-get install -y patchelf
sudo apt-get install -y libxcb-shape0-dev
sudo apt-get install -y libxcb-xfixes0-dev
sudo apt-get install -y libxdo-dev
- name: install frontend dependencies
run: yarn install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ env.PACKAGE_VERSION }}
releaseName: ${{ env.PACKAGE_VERSION }}
releaseDraft: false
prerelease: false
- name: upload deb (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }}
asset_name: ${{ env.DEB_PKG_NAME }}
tag: ${{ env.PACKAGE_VERSION }}
overwrite: true
- name: copy deb package && create PKGBUILD (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
mkdir ${{ env.BIN_PATH }}
cp -fr ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} ${{ env.BIN_PATH }}/${{ env.DEB_PKG_RENAMED }}
cat <<EOF > ./${{ env.BIN_PATH }}/PKGBUILD
# Maintainer: ${{ github.repository_owner }} <${{ env.EMAIL }}>
# Contributor: ${{ github.repository_owner }} <${{ env.EMAIL }}>
_packager="${{ github.repository_owner }} <${{ env.EMAIL }}>"
_deb_pkgname=${{ env.PACKAGE_NAME }}
pkgname=${{ env.BIN_PATH }}
pkgver=${{ env.PACKAGE_VERSION }}
md5sums=('$(md5sum ${{ env.BIN_PATH }}/${{ env.DEB_PKG_RENAMED }} | awk '{print $1}')')
pkgrel=1
depends=('libappindicator-gtk3' 'webkit2gtk' 'gtk3')
pkgdesc='${{ env.DESCRIPTION }}'
arch=('${{ env.ARCH }}')
url="https://github.com/${{ github.repository }}"
license=('${{ env.LICENSE }}')
source=("\$url/releases/download/${{ env.PACKAGE_VERSION }}/${{ env.DEB_PKG_RENAMED }}")
build() {
rm control.tar.gz
tar xvf data.tar.gz
}
package() {
cp -fr usr/ \${pkgdir}
}
EOF
cat ${{ env.BIN_PATH }}/PKGBUILD
ls -la ${{ env.BIN_PATH }}
- name: create arch package (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
uses: 2m/[email protected]
with:
debug: true
target: pkgbuild
pkgname: ${{ env.BIN_PATH }}/
- name: create rpm package (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update && sudo apt-get install -y sudo make alien
alien -r -k --scripts --target=x86_64 ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }}
- name: create checksums (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
md5sum ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME}} > ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }}.md5sum
md5sum ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} > ${{ env.DEB_PKG_NAME }}.md5sum
md5sum ${{ env.RPM_PKG_NAME }} > ${{ env.RPM_PKG_NAME }}.md5sum
- name: upload arch && rpm release (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.PACKAGE_VERSION }}
files: |
${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }}
${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }}.md5sum
${{ env.DEB_PKG_NAME }}.md5sum
${{ env.RPM_PKG_NAME }}
${{ env.RPM_PKG_NAME }}.md5sum