-
Notifications
You must be signed in to change notification settings - Fork 7
143 lines (138 loc) · 4.67 KB
/
deb_arm64.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
name: deb-build
on:
push:
tags: [ "v*" ]
jobs:
package:
runs-on: arm64
strategy:
matrix:
target:
[
"arm64v8/ubuntu:20.04",
"arm64v8/ubuntu:22.04",
"arm64v8/ubuntu:24.04",
"arm64v8/debian:11",
"arm64v8/debian:12",
"arm64v8/debian:trixie",
"linuxdeepin/deepin:beige-arm64-v1.4.0",
"chenchongbiao/openkylin:nile-arm64",
]
container:
image: "${{ matrix.target }}"
steps:
- name: Install Dependencies
shell: bash
env:
TARGET_DISTRO: "${{ matrix.target }}"
run: |
echo "${TARGET_DISTRO}"
if [[ "${TARGET_DISTRO}" = "linuxdeepin/deepin:beige-arm64-v1.4.0" ]]; then
sed -e 's|https://community-packages.deepin.com|https://mirrors.bfsu.edu.cn/deepin|g' -i /etc/apt/sources.list;
fi
apt-get update
env DEBIAN_FRONTEND=noninteractive apt-get install -y curl
if [[ "${TARGET_DISTRO}" != "chenchongbiao/openkylin:nile-arm64" ]]; then
curl -fsSL https://deb.nodesource.com/setup_22.x | bash;
fi
env DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential zlib1g-dev libssl-dev pkgconf nettle-dev libapt-pkg-dev curl xz-utils clang openssh-client rsync nodejs libbz2-dev liblzma-dev
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: false
- uses: Swatinem/rust-cache@v2
with:
key: "${{ matrix.target }}"
- name: Install cargo-deb
run: cargo install -f cargo-deb
- name: Build deb package
shell: bash
run: |
cargo deb -Z xz
VER_SUFFIX="${TARGET_DISTRO/:/}"
VER_SUFFIX="${VER_SUFFIX##*\/}"
case "${TARGET_DISTRO}" in
'arm64v8/debian:11')
CODENAME='bullseye'
;;
'arm64v8/debian:12')
CODENAME='bookworm'
;;
'arm64v8/debian:trixie')
CODENAME='trixie'
VER_SUFFIX='debian13'
;;
'arm64v8/ubuntu:20.04')
CODENAME='focal'
;;
'arm64v8/ubuntu:22.04')
CODENAME='jammy'
;;
'arm64v8/ubuntu:24.04')
CODENAME='noble'
;;
'linuxdeepin/deepin:beige-arm64-v1.4.0')
CODENAME='beige'
VER_SUFFIX="deepin23"
;;
'chenchongbiao/openkylin:nile-arm64')
CODENAME='nile'
VER_SUFFIX="openkylin2.0"
;;
esac
for i in target/debian/*.deb; do
mv -v "${i}" "${i/\.deb/-$VER_SUFFIX.deb}"
done
echo "VER_SUFFIX=${VER_SUFFIX}" >> "${GITHUB_ENV}"
echo "CODENAME=${CODENAME}" >> "${GITHUB_ENV}"
env:
TARGET_DISTRO: "${{ matrix.target }}"
- name: Setup SSH private key
env:
KEY: ${{ secrets.KEY }}
run: |
mkdir -p ~/.ssh/
chmod 0700 ~/.ssh/
echo "$KEY" > ~/.ssh/id_ed25519
cp .github/workflows/known_hosts ~/.ssh/known_hosts
chmod 0600 ~/.ssh/id_ed25519 ~/.ssh/known_hosts
- name: Upload packages (repository)
shell: bash
run: |
rsync \
--ignore-existing \
-v \
-e "ssh \
-o IdentityFile=$HOME/.ssh/id_ed25519 \
-o UserKnownHostsFile=$HOME/.ssh/known_hosts" \
target/debian/*-"${VER_SUFFIX}".deb \
${USER}@repo.aosc.io:/mirror/oma/pool/"${CODENAME}"/main/o/
ssh \
-v \
-o IdentityFile=~/.ssh/id_ed25519 \
-o UserKnownHostsFile=~/.ssh/known_hosts \
${USER}@repo.aosc.io \
touch /mirror/.updated
env:
TARGET_DISTRO: "${{ matrix.target }}"
USER: ${{ secrets.USER }}
- name: Upload packages (GitHub Release)
uses: actions/upload-artifact@v4
with:
name: ${{ env.VER_SUFFIX }}
path: "target/debian/*.deb"
# Release stage
release:
runs-on: ubuntu-latest
needs: package
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/download-artifact@v4
- name: Upload artifacts
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_paths: '["./**/*.tar.*","./**/*.deb"]'