-
Notifications
You must be signed in to change notification settings - Fork 7
195 lines (166 loc) · 6.87 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
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
name: Build
on:
push:
branches: [master]
tags:
- 'v*'
pull_request:
branches: [master]
env:
DEBIAN_FRONTEND: noninteractive
jobs:
build-artifact:
runs-on: ubuntu-latest
container:
image: ${{matrix.image}}
options: --privileged
strategy:
matrix:
image: ['ubuntu:23.04', 'ubuntu:22.10', 'ubuntu:22.04', 'ubuntu:20.04', 'debian:12', 'debian:11', 'debian:10', 'opensuse/leap:15.5', 'opensuse/leap:15.4', 'fedora:38', 'fedora:37']
fail-fast: false
steps:
- name: Install dependencies (ubuntu & debian)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
run: apt update && apt install -y wget file dpkg-dev fuse git g++ cmake qtbase5-dev libxdo-dev
- name: Install dependencies (opensuse)
if: startsWith(matrix.image, 'opensuse')
run: zypper refresh && zypper install -y tar gzip rpm-build git gcc-c++ cmake libqt5-qtbase-devel xdotool-devel
- name: Install dependencies (fedora)
if: startsWith(matrix.image, 'fedora')
run: dnf clean expire-cache && dnf install -y tar gzip rpm-build git gcc-c++ cmake qt5-qtbase-devel libxdo-devel
- name: Install dependencies .AppImage
if: startsWith(matrix.image, 'ubuntu:20.04')
run: |
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
cp ./linuxdeployqt-continuous-x86_64.AppImage /usr/bin/linuxdeployqt.AppImage
- uses: actions/checkout@v3
- run: git config --global --add safe.directory $(realpath .)
continue-on-error: true
- run: git fetch --prune --unshallow --tags --force
continue-on-error: true
- name: Set CPACK_GENERATOR to DEB (ubuntu / debian)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
run: |
echo "CPACK_GENERATOR=DEB" >> $GITHUB_ENV
- name: Set CPACK_GENERATOR to RPM (opensuse / fedora)
if: startsWith(matrix.image, 'opensuse') || startsWith(matrix.image, 'fedora')
run: |
echo "CPACK_GENERATOR=RPM" >> $GITHUB_ENV
- name: Create artifact version
run: |
VERSION_LATEST_TAG=$(git describe --match "v[0-9]*" --abbrev=0 HEAD | sed "s/v//")
VERSION_TIMESTAMP=$(date +'%Y%m%d%H%M')
VERSION_GIT_HASH=$(git rev-parse --short HEAD)
VERSION=$VERSION_LATEST_TAG+git$VERSION_TIMESTAMP.$VERSION_GIT_HASH
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION"
continue-on-error: true
- name: Configure
run: |
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=${{env.CPACK_GENERATOR}} -DPACKAGE_VERSION=${{env.VERSION}} ..
- name: Build
run: |
cd build
make -j$(nproc)
- name: Package
run: |
cd build
make package
- name: Package .AppImage
if: startsWith(matrix.image, 'ubuntu:20.04')
run: |
cd build
make appimage
- name: Create artifact name
run: |
DISTRO_ID=$(grep "^ID=" "/etc/os-release" | sed "s/ID=//" | sed "s/\"//g")
DISTRO_VERSION_ID=$(grep "^VERSION_ID=" "/etc/os-release" | sed "s/VERSION_ID=//" | sed "s/\"//g")
ARTIFACT_NAME=x11-emoji-picker-x86_64
ARTIFACT_NAME_WITH_DISTRO=$ARTIFACT_NAME-$DISTRO_ID-$DISTRO_VERSION_ID
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
echo "ARTIFACT_NAME_WITH_DISTRO=$ARTIFACT_NAME_WITH_DISTRO" >> $GITHUB_ENV
echo "ARTIFACT_NAME_WITH_DISTRO=$ARTIFACT_NAME_WITH_DISTRO"
- name: Rename artifact .deb (ubuntu / debian)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
run: |
mv build/x11-emoji-picker-x86_64.deb build/${{env.ARTIFACT_NAME_WITH_DISTRO}}.deb
- name: Rename artifact .rpm (opensuse / fedora)
if: startsWith(matrix.image, 'opensuse') || startsWith(matrix.image, 'fedora')
run: |
mv build/x11-emoji-picker-x86_64.rpm build/${{env.ARTIFACT_NAME_WITH_DISTRO}}.rpm
- name: Rename artifact .AppImage
if: startsWith(matrix.image, 'ubuntu:20.04')
run: |
mv build/x11-emoji-picker-dev-x86_64.AppImage build/${{env.ARTIFACT_NAME}}.AppImage
- name: Upload artifact .deb (ubuntu / debian)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME_WITH_DISTRO}}.deb
path: build/*.deb
if-no-files-found: error
- name: Upload artifact .rpm (opensuse / fedora)
if: startsWith(matrix.image, 'opensuse') || startsWith(matrix.image, 'fedora')
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME_WITH_DISTRO}}.rpm
path: build/*.rpm
if-no-files-found: error
- name: Upload artifact .AppImage
if: startsWith(matrix.image, 'ubuntu:20.04')
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME}}.AppImage
path: build/*.AppImage
if-no-files-found: error
create-nightly-release:
needs: build-artifact
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Download artifacts
id: download_artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create nightly
id: create_release
uses: ncipollo/[email protected]
with:
removeArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "${{steps.download_artifacts.outputs.download-path}}/*/*"
body: ${{github.event.head_commit.message}}
prerelease: true
makeLatest: false
name: Nightly Release
tag: nightly-build
create-release:
needs: build-artifact
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Download artifacts
id: download_artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create nightly
id: create_release
uses: ncipollo/[email protected]
with:
removeArtifacts: false
allowUpdates: false
artifactErrorsFailBuild: true
artifacts: "${{steps.download_artifacts.outputs.download-path}}/*/*"
generateReleaseNotes: true
prerelease: false
makeLatest: true
name: ${{env.RELEASE_VERSION}}
tag: ${{github.ref}}