-
-
Notifications
You must be signed in to change notification settings - Fork 174
207 lines (175 loc) · 8.44 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
199
200
201
202
203
204
205
206
207
# Workflow to create a release when a new tag is created
# It will generate the release on GitHub and attach the packages
name: Release
on:
push:
tags:
- '*'
jobs:
deb-package:
runs-on: ubuntu-22.04
env:
target_docker_image: debian:bookworm-backports
target_distribution: bookworm
strategy:
matrix:
target_arch: ["amd64", "armhf", "arm64"]
steps:
- name: GitHub Environment Variables Action
uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: Checkout code
uses: actions/checkout@v3
- name: Patch target distribution in Debian changelog
# touchegg (x.y.z) DISTRO; urgency=medium
# -z to replace only the first occurrence
# -i to update the file
# ([)] ) - Group 0, find the first ") "
# (\w+) - Group 1, find a word (DISTRO)
# \1${{ env.target_distribution }} - Replace group 1 with the target distribution name
run: |
sed -zri "s/([)] )(\w+)/\1${{ env.target_distribution }}/" ${{ github.workspace }}/debian/changelog
- name: Build Debian package
uses: pi-top/action-debian-package@v0.2.2
with:
source_directory: "${{ github.workspace }}"
artifacts_directory: "${{ github.workspace }}/artifacts"
docker_image: ${{ env.target_docker_image }}
distribution: ${{ env.target_distribution }}
target_architecture: ${{ matrix.target_arch }}
lintian_opts: "-profile debian --dont-check-part nmu --no-tag-display-limit --display-info --show-overrides"
# Package uses latest packaging syntax and Lintian opts/tags
dpkg_buildpackage_opts: "--no-sign --no-check-builddeps --post-clean"
- name: Upload Debian package artifacts
uses: "actions/upload-artifact@v2"
with:
name: "${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_${{matrix.target_arch}}.deb"
path: "${{ github.workspace }}/artifacts/${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_${{matrix.target_arch}}.deb"
rpm-package-rhel:
runs-on: ubuntu-22.04
container:
image: almalinux:9
steps:
- name: Install dependencies
run: |
su
dnf upgrade -y
dnf install -y dnf-plugins-core
dnf config-manager --set-enabled powertools
dnf install -y epel-release
dnf groupinstall -y "Development Tools"
dnf install -y gcc gcc-c++ cmake rpm-build libudev-devel libinput-devel pugixml-devel cairo-devel libX11-devel libXtst-devel libXrandr-devel libXi-devel glib2-devel gtk3-devel
- name: GitHub Environment Variables Action
uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: Checkout code
uses: actions/checkout@v3
with:
path: ${{ env.GITHUB_REPOSITORY_NAME }}
- name: Create rpmbuild directories
run: |
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- name: Generate tarball
run: |
tar -czvf ~/rpmbuild/SOURCES/${{ env.GITHUB_REPOSITORY_NAME }}.tar.gz ${{ env.GITHUB_REPOSITORY_NAME }} --transform s/^touchegg/touchegg-${{ env.GITHUB_REF_NAME }}/
- name: Build RPM package
run: |
rpmbuild -ba ${{ env.GITHUB_REPOSITORY_NAME }}/rpm/${{ env.GITHUB_REPOSITORY_NAME }}.spec
- name: Upload RPM package
uses: "actions/upload-artifact@v2"
with:
name: "rhel8_${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm"
path: "~/rpmbuild/RPMS/x86_64/${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm"
rpm-package-fedora:
runs-on: ubuntu-22.04
container:
image: fedora:38
steps:
- name: Install dependencies
run: |
dnf upgrade -y
dnf groupinstall -y "Development Tools"
dnf install -y gcc gcc-c++ cmake rpm-build libudev-devel libinput-devel pugixml-devel cairo-devel libX11-devel libXtst-devel libXrandr-devel libXi-devel glib2-devel gtk3-devel
- name: GitHub Environment Variables Action
uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: Checkout code
uses: actions/checkout@v3
with:
path: ${{ env.GITHUB_REPOSITORY_NAME }}
- name: Create rpmbuild directories
run: |
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- name: Generate tarball
run: |
tar -czvf ~/rpmbuild/SOURCES/${{ env.GITHUB_REPOSITORY_NAME }}.tar.gz ${{ env.GITHUB_REPOSITORY_NAME }} --transform s/^touchegg/touchegg-${{ env.GITHUB_REF_NAME }}/
- name: Build RPM package
run: |
rpmbuild -ba ${{ env.GITHUB_REPOSITORY_NAME }}/rpm/${{ env.GITHUB_REPOSITORY_NAME }}.spec
- name: Upload RPM package
uses: "actions/upload-artifact@v2"
with:
name: "fedora34_${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm"
path: "~/rpmbuild/RPMS/x86_64/${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm"
create-release:
runs-on: ubuntu-22.04
needs: [ deb-package, rpm-package-rhel, rpm-package-fedora ]
steps:
- name: GitHub Environment Variables Action
uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: Download packages
uses: "actions/download-artifact@v2"
with:
path: ./
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GITHUB_REF_NAME }}
release_name: ${{ env.GITHUB_REF_NAME }}
draft: true
prerelease: false
- name: Upload Debian package (amd64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_amd64.deb/${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_amd64.deb"
asset_name: "${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_amd64.deb"
asset_content_type: application/vnd.debian.binary-package
- name: Upload Debian package (armhf)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_armhf.deb/${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_armhf.deb"
asset_name: "${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_armhf.deb"
asset_content_type: application/vnd.debian.binary-package
- name: Upload Debian package (arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_arm64.deb/${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_arm64.deb"
asset_name: "${{ env.GITHUB_REPOSITORY_NAME }}_${{ env.GITHUB_REF_NAME }}_arm64.deb"
asset_content_type: application/vnd.debian.binary-package
- name: Upload RPM package (RHEL)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "rhel8_${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm/${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm"
asset_name: "rhel8_${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm"
asset_content_type: application/octet-stream
- name: Upload RPM package (Fedora)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "fedora34_${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm/${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm"
asset_name: "fedora34_${{ env.GITHUB_REPOSITORY_NAME }}-${{ env.GITHUB_REF_NAME }}-1.x86_64.rpm"
asset_content_type: application/octet-stream