-
Notifications
You must be signed in to change notification settings - Fork 8
175 lines (169 loc) · 6.08 KB
/
Copy pathbuild.yml
File metadata and controls
175 lines (169 loc) · 6.08 KB
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
name: Build waytrogen
on:
push:
tags:
- "*.*.*"
jobs:
build-prefix-usr-binary:
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v4
- name: Get dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-4-1 openssl libsqlite3-0 libsqlite3-dev libglib2.0-dev sqlite3 libgtk-4-dev meson ninja-build cargo gettext desktop-file-utils
version: cargo-deps-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Rust Artifacts
uses: Swatinem/rust-cache@v2
with:
cache-directories: "./target"
- name: Build waytrogen
run: cargo build --release
- name: Upload ccompiled binary
uses: actions/upload-artifact@v4
id: compiled-meson-project
with:
name: waytrogen_${{ github.ref_name }}_amd64
path: ./target/release/waytrogen
package-deb-file:
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v4
- name: Get dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-4-1 openssl libsqlite3-0 libsqlite3-dev libglib2.0-dev sqlite3 libgtk-4-dev meson ninja-build cargo gettext desktop-file-utils
version: cargo-deps-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Rust Artifacts
uses: Swatinem/rust-cache@v2
with:
cache-directories: "builddir/target"
- name: Build waytrogen
run: |
TAG=${{ github.ref_name }}
PACKAGE_NAME="waytrogen_${TAG}_amd64"
PREFIX="debpkgs/${PACKAGE_NAME}"
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV
sed -i "s/VERSION/${TAG}/" meson.build
meson setup builddir --prefix="$(realpath $PREFIX)"
meson compile -C builddir
meson install -C builddir
mkdir -p "$PREFIX/DEBIAN"
mv debpkgs/control debpkgs/postinst "$PREFIX/DEBIAN"
sed -i "s/VERSION/${TAG}/" "$PREFIX/DEBIAN/control"
chmod 755 "$PREFIX/DEBIAN/postinst"
dpkg-deb --build "$PREFIX"
- name: Upload deb package
uses: actions/upload-artifact@v4
with:
name: "${{ env.PACKAGE_NAME }}.deb"
path: debpkgs/*.deb
get-vendored-dependencies:
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v4
- name: Generate vendor tarball
uses: dtolnay/rust-toolchain@stable
- run: |
cargo vendor vendor/
tar -czf waytrogen-${{ github.ref_name }}-vendor.tar.gz vendor
- name: Upload vendored dependencies
uses: actions/upload-artifact@v4
with:
name: waytrogen-${{ github.ref_name }}-vendor.tar.gz
path: waytrogen-${{ github.ref_name }}-vendor.tar.gz
create-release:
needs: [ build-prefix-usr-binary, package-deb-file, get-vendored-dependencies ]
runs-on: ubuntu-latest
steps:
- name: Get generic build prefix usr binary
uses: actions/download-artifact@v4
with:
name: waytrogen_${{ github.ref_name }}_amd64
- name: Rename precompiled binary
run: mv waytrogen waytrogen_${{ github.ref_name }}_amd64
- name: Get deb file
uses: actions/download-artifact@v4
with:
name: waytrogen_${{ github.ref_name }}_amd64.deb
- name: Get vendor file
uses: actions/download-artifact@v4
with:
name: waytrogen-${{ github.ref_name }}-vendor.tar.gz
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
waytrogen_${{ github.ref_name }}_amd64
waytrogen_${{ github.ref_name }}_amd64.deb
waytrogen-${{ github.ref_name }}-vendor.tar.gz
make_latest: 'true'
publish-waytrogen-to-aur:
needs: [ create-release ]
runs-on: ubuntu-latest
steps:
- name: Get AUR PKGBUILD
run: |
git clone https://aur.archlinux.org/waytrogen.git
- name: Prepare PKGBUILD
run:
sed -i "s/pkgver=.*/pkgver=${{ github.ref_name }}/" waytrogen/PKGBUILD
- name: Publish to AUR
uses: KSXGitHub/github-actions-deploy-aur@v4.1.3
with:
pkgname: waytrogen
pkgbuild: ./waytrogen/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Update to ${{ github.ref_name }}
publish-waytrogen-bin-to-aur:
permissions:
contents: write
needs: create-release
runs-on: ubuntu-latest
steps:
- name: Get AUR PKGBUILD
run: |
git clone https://aur.archlinux.org/waytrogen-bin.git
- name: Prepare PKGBUILD
run:
sed -i "s/pkgver=.*/pkgver=${{ github.ref_name }}/" waytrogen-bin/PKGBUILD
- name: Publish to AUR
uses: KSXGitHub/github-actions-deploy-aur@v4.1.3
with:
pkgname: waytrogen-bin
pkgbuild: ./waytrogen-bin/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Update to ${{ github.ref_name }}
publish-waytrogen-to-copr:
needs: [ create-release ]
container: fedora:latest
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v4
- name: Install API token for copr-cli
env:
API_TOKEN_CONTENT: ${{ secrets.COPR_CLI_CONFIG }}
run: |
mkdir -p "$HOME/.config"
echo "$API_TOKEN_CONTENT" > "$HOME/.config/copr"
- name: Install build tools
run: |
dnf -y install @development-tools @rpm-development-tools
dnf -y install copr-cli
- name: Get Source Files
run: |
spectool -g -R waytrogen.spec
- name: Build SRPM
run: |
rpmbuild -bs waytrogen.spec
- name: Upload SRPM to COPR
run: |
copr-cli build waytrogen ~/rpmbuild/SRPMS/waytrogen-*.src.rpm