62 lines
2.1 KiB
YAML
62 lines
2.1 KiB
YAML
name: Release binary and debian package for cl-cli
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v**
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: https://github.com/actions/checkout@v4
|
|
- name: Install rust toolchain
|
|
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
|
|
with:
|
|
path: .changes/${{ github.ref_name }}.md
|
|
- name: Release
|
|
uses: https://gitea.com/akkuman/gitea-release-action@v1
|
|
env:
|
|
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
|
with:
|
|
files: |-
|
|
config.toml.dist
|
|
md5sum: true
|
|
sha256sum: true
|
|
body_path: .changes/${{ github.ref_name }}.md
|