v1.13.9 #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deb-build | |
on: | |
push: | |
tags: [ "v*" ] | |
jobs: | |
package: | |
runs-on: loong64 | |
strategy: | |
matrix: | |
target: | |
[ | |
"lcr.loongnix.cn/library/debian", | |
# "linuxdeepin/deepin:beige-loong64-v1.4.0", 编译 cargo-deb 会卡住 | |
] | |
container: | |
image: "${{ matrix.target }}" | |
steps: | |
- name: Install Dependencies | |
shell: bash | |
env: | |
TARGET_DISTRO: "${{ matrix.target }}" | |
run: | | |
if [[ "${TARGET_DISTRO}" = "linuxdeepin/deepin:beige-loong64-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 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 | |
'lcr.loongnix.cn/library/debian') | |
CODENAME='trixie' | |
VER_SUFFIX='debian13' | |
;; | |
'linuxdeepin/deepin:beige-loong64-v1.4.0') | |
CODENAME='beige' | |
VER_SUFFIX="${VER_SUFFIX}23" | |
;; | |
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"]' |