-
Notifications
You must be signed in to change notification settings - Fork 5
172 lines (150 loc) · 6.69 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
name: "publish"
on:
workflow_dispatch:
push:
branches: [master]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
ARCH: x86_64
DEPENDENCIES_ARCH: "'libappindicator-gtk3' 'webkit2gtk' 'gtk3' 'xdotool'"
DEPENDENCIES_RPM: "javascriptcoregtk4.0, webkit2gtk4.0, libxdo, libappindicator-gtk3, xdotool"
jobs:
setup:
runs-on: ubuntu-latest
outputs:
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/
deb_pkg_renamed: ${{ steps.get-package.outputs.name }}-${{ steps.get-package.outputs.version }}-${{ env.ARCH }}.deb
arch_pkg_name: ${{ steps.get-package.outputs.name }}-bin-${{ steps.get-package.outputs.version }}-1-${{ env.ARCH }}.pkg.tar.zst
rpm_pkg_name: RPMS/${{ steps.get-package.outputs.name }}-${{ steps.get-package.outputs.version }}-1.${{ env.ARCH }}.rpm
tag_name: v${{ steps.get-package.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
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
echo "license=$(node -p "require('./package.json').license")" >> $GITHUB_OUTPUT
build-tauri:
needs: [setup]
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
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 libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev libxcb-shape0-dev libxcb-xfixes0-dev libxdo-dev
- name: install frontend dependencies
run: yarn install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ needs.setup.outputs.tag_name }}
releaseName: ${{ needs.setup.outputs.tag_name }}
releaseDraft: false
prerelease: false
- name: copy deb package && create PKGBUILD file (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
mkdir -p ${{ needs.setup.outputs.name_bin }}
cp -fr ${{ needs.setup.outputs.deb_pkg_path }}${{ needs.setup.outputs.deb_pkg_name }} ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }}
cat <<EOF > ./${{ needs.setup.outputs.name_bin }}/PKGBUILD
pkgname=${{ needs.setup.outputs.name_bin }}
pkgver=${{ needs.setup.outputs.version }}
md5sums=('$(md5sum ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }} | awk '{print $1}')')
pkgrel=1
depends=(${{ env.DEPENDENCIES_ARCH }})
pkgdesc='${{ needs.setup.outputs.description }}'
arch=('${{ env.ARCH }}')
url="https://github.com/${{ github.repository }}"
license=('${{ needs.setup.outputs.license }}')
source=("\$url/releases/download/${{ needs.setup.outputs.tag_name }}/${{ needs.setup.outputs.deb_pkg_renamed }}")
build() {
rm control.tar.gz
tar xvf data.tar.gz
}
package() {
cp -fr usr/ \${pkgdir}
}
EOF
cat ${{ needs.setup.outputs.name_bin }}/PKGBUILD
- name: create arch package (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
uses: 2m/arch-pkgbuild-builder@v1.17
with:
debug: true
target: pkgbuild
pkgname: ${{ needs.setup.outputs.name_bin }}/
- name: copy deb package && create rpm.spec file (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
mkdir -p ${{ needs.setup.outputs.name_bin }}
cp -fr ${{ needs.setup.outputs.deb_pkg_path }}/${{ needs.setup.outputs.deb_pkg_name }} ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }}
cat <<EOF > ./${{ needs.setup.outputs.name_bin }}/rpm.spec
Name: ${{ needs.setup.outputs.name }}
Version: ${{ needs.setup.outputs.version }}
BuildArch: ${{ env.ARCH }}
Release: 1
Summary: ${{ needs.setup.outputs.description }}
Requires: ${{ env.DEPENDENCIES_RPM }}
License: ${{ needs.setup.outputs.license }}
Source0: ${{ needs.setup.outputs.deb_pkg_renamed }}
%description
${{ needs.setup.outputs.description }}
%prep
ar x %{SOURCE0}
%build
rm -rf control.tar.gz
tar xvf data.tar.gz
%install
cp -fr usr/ %{buildroot}
%files
%{_bindir}/${{ needs.setup.outputs.name }}
/usr/share/applications/${{ needs.setup.outputs.name }}.desktop
/usr/share/icons/hicolor/**/*
EOF
cat ${{ needs.setup.outputs.name_bin }}/rpm.spec
- name: createa rpm package (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
uses: Antikythera/build-rpm@latest
with:
spec_file: ${{ needs.setup.outputs.name_bin }}/rpm.spec
sources: ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }}
- 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: ${{ needs.setup.outputs.tag_name }}
files: |
${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.arch_pkg_name }}
${{ needs.setup.outputs.rpm_pkg_name }}