-
Notifications
You must be signed in to change notification settings - Fork 20
172 lines (149 loc) · 5.18 KB
/
release.yaml
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: Release
on:
push:
branches:
- release/*
tags:
- "v*"
defaults:
run:
shell: bash
env:
MAINTAINER: "xrelkd <46590321+xrelkd@users.noreply.github.com>"
PACKAGE_NAME: "clipcat"
PACKAGE_DESCRIPTION: "Clipboard manager written in Rust Programming Language"
jobs:
all:
name: Release
strategy:
matrix:
target:
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
- x86_64-unknown-linux-musl
# TODO: support macOS in the future?
# - x86_64-apple-darwin
include:
- target: aarch64-unknown-linux-musl
arch_deb: arm64
arch_rpm: aarch64
os: ubuntu-latest
target_rustflags: "--codegen linker=aarch64-linux-gnu-gcc"
- target: armv7-unknown-linux-musleabihf
arch_deb: armhf
arch_rpm: armhf # Fedora does not support armv7
os: ubuntu-latest
target_rustflags: "--codegen linker=arm-linux-gnueabihf-gcc"
- target: x86_64-unknown-linux-musl
arch_deb: amd64
arch_rpm: x86_64
os: ubuntu-latest
target_rustflags: ""
# TODO: support macOS in the future?
# - target: x86_64-apple-darwin
# os: macos-latest
# target_rustflags: ""
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt install -y --no-install-recommends musl-tools protobuf-compiler libprotobuf-dev
- name: Install Rust Toolchain Components
uses: actions-rs/toolchain@v1
with:
override: true
target: ${{ matrix.target }}
toolchain: stable
- name: Install AArch64 Toolchain
if: ${{ matrix.target == 'aarch64-unknown-linux-musl' }}
run: |
sudo apt update
sudo apt install -y gcc-aarch64-linux-gnu
echo 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc' >>"$GITHUB_ENV"
echo 'CC=aarch64-linux-gnu-gcc' >>"$GITHUB_ENV"
- name: Install ARM7 Toolchain
if: ${{ matrix.target == 'armv7-unknown-linux-musleabihf' }}
run: |
sudo apt update
sudo apt install -y gcc-arm-linux-gnueabihf
- name: Create Package
id: package
env:
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
OS: ${{ matrix.os }}
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }}
run: ./dev-support/bin/create-package
shell: bash
- name: Prepare DEB Package
env:
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
OS: ${{ matrix.os }}
ARCH: ${{ matrix.arch_deb }}
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }}
run: ./dev-support/bin/prepare-deb-package
if: ${{ matrix.arch_deb == 'amd64' }}
shell: bash
- name: Create DEB Package
id: deb-package
uses: jiro4989/build-deb-action@v3
if: ${{ matrix.arch_deb == 'amd64' }}
with:
package: ${{ env.PACKAGE_NAME }}
package_root: .debpkg
maintainer: ${{ env.MAINTAINER }}
version: ${{ github.ref }}
arch: ${{ matrix.arch_deb }}
desc: ${{ env.PACKAGE_DESCRIPTION }}
- name: Prepare RPM Package
env:
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
OS: ${{ matrix.os }}
ARCH: ${{ matrix.arch_rpm }}
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }}
run: ./dev-support/bin/prepare-rpm-package
if: ${{ matrix.arch_rpm == 'x86_64' }}
shell: bash
- name: Create RPM Package
id: rpm-package
uses: jiro4989/build-rpm-action@v2
if: ${{ matrix.arch_rpm == 'x86_64' }}
with:
summary: ${{ env.PACKAGE_DESCRIPTION }}
package: ${{ env.PACKAGE_NAME }}
package_root: .rpmpkg
maintainer: ${{ env.MAINTAINER }}
version: ${{ github.ref }}
arch: ${{ matrix.arch_rpm }}
desc: ${{ env.PACKAGE_DESCRIPTION }}
- name: Publish Package Archive
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: false
files: ${{ steps.package.outputs.archive }}
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish DEB Package
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.arch_deb == 'amd64' }}
with:
draft: false
files: ${{ steps.deb-package.outputs.file_name }}
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish RPM Package
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.arch_rpm == 'x86_64' }}
with:
draft: false
files: ${{ steps.rpm-package.outputs.file_name }}
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}