Update release workflow to include Debian package build and upload
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Release binary for cl-cli
|
||||
name: Release binary and debian package for cl-cli
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -15,6 +15,35 @@ jobs:
|
||||
uses: https://github.com/dtolnay/rust-toolchain@stable
|
||||
- name: Build binaries
|
||||
run: cargo build --release
|
||||
- name: Install cargo-deb
|
||||
run: cargo install cargo-deb
|
||||
- name: Build Debian package
|
||||
run: cargo deb
|
||||
- name: Upload Debian package to Gitea registry
|
||||
env:
|
||||
GITEA_SERVER_URL: "https://gitea.champs-libres.be"
|
||||
GITEA_OWNER: ${{ secrets.GITEA_OWNER }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
DEB_DISTRIBUTIONS: noble,plucky,questing
|
||||
DEB_COMPONENT: main
|
||||
DEB_ARCH: amd64
|
||||
run: |
|
||||
set -euo pipefail
|
||||
DEB_FILE=$(ls target/debian/*.deb | head -n1)
|
||||
env
|
||||
if [ -z "${DEB_FILE}" ]; then
|
||||
echo "No .deb file found in target/debian" >&2
|
||||
exit 1
|
||||
fi
|
||||
# comma-separated in DEB_DISTRIBUTIONS, e.g. "noble,plucky,questing"
|
||||
IFS=',' read -r -a DISTROS <<< "$DEB_DISTRIBUTIONS"
|
||||
for DISTRO in "${DISTROS[@]}"; do
|
||||
echo "Uploading ${DEB_FILE} to ${GITEA_SERVER_URL} for owner ${GITEA_OWNER}"
|
||||
curl -sSf -X PUT \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
--upload-file @"${DEB_FILE}" \
|
||||
"${GITEA_SERVER_URL}/api/packages/${GITEA_OWNER}/debian/pool/${DISTRO}/main/upload"
|
||||
done
|
||||
- name: Read release content
|
||||
uses: https://github.com/jaywcjlove/github-action-read-file@main
|
||||
id: read_release
|
||||
@@ -26,7 +55,6 @@ jobs:
|
||||
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
||||
with:
|
||||
files: |-
|
||||
target/release/cl-cli
|
||||
config.toml.dist
|
||||
md5sum: true
|
||||
sha256sum: true
|
||||
|
||||
Reference in New Issue
Block a user