96 lines
2.6 KiB
YAML
96 lines
2.6 KiB
YAML
---
|
|
name: spdlog
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- .forgejo/workflows/spdlog.yaml
|
|
pull_request:
|
|
paths:
|
|
- .forgejo/workflows/spdlog.yaml
|
|
|
|
env:
|
|
REPO: https://github.com/gabime/spdlog
|
|
PKGNAME: spdlog
|
|
UPSTREAM_VER: '1.15.0'
|
|
EXTRA_VER: compair4
|
|
|
|
jobs:
|
|
build-deb:
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- runs-on-image: node-24-arm64
|
|
|
|
runs-on: ${{ matrix.platform.runs-on-image }}
|
|
|
|
steps:
|
|
- name: Checkout spdlog
|
|
env:
|
|
TAG: 'v${{ env.UPSTREAM_VER }}'
|
|
run: |
|
|
git config --global --add safe.directory $PWD
|
|
git init
|
|
git remote add origin "$REPO"
|
|
git config --local gc.auto 0
|
|
git fetch --depth=1 --no-tags --prune origin refs/tags/$TAG
|
|
git checkout FETCH_HEAD
|
|
|
|
- name: Install prerequisites
|
|
run: |
|
|
apt update
|
|
apt install -y build-essential cmake g++
|
|
|
|
- name: Build package
|
|
run: |
|
|
mkdir -p build
|
|
cd build
|
|
cmake -B . -S .. \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
|
-DSPDLOG_BUILD_EXAMPLE=OFF \
|
|
-DCPACK_OUTPUT_FILE_PREFIX=../_packages \
|
|
-DCPACK_DEBIAN_PACKAGE_RELEASE=$EXTRA_VER
|
|
cmake --build . -- -j2
|
|
cpack -G DEB --build .
|
|
|
|
- name: Print packages contents
|
|
run: |
|
|
for f in _packages/*.deb; do
|
|
echo "$f:"
|
|
dpkg-deb -c "$f"
|
|
echo
|
|
done
|
|
|
|
- name: Print packages control info
|
|
run: |
|
|
for f in _packages/*.deb; do
|
|
echo "$f:"
|
|
dpkg-deb -e "$f"
|
|
cat DEBIAN/control
|
|
echo
|
|
done
|
|
|
|
# https://forgejo.org/docs/latest/user/packages/debian/#publish-a-package
|
|
- name: push deb to apt repository
|
|
if: github.ref == 'refs/heads/master'
|
|
env:
|
|
REPO: ${{ github.repository }}
|
|
TAG: ${{ steps.tag.outputs.tag }}
|
|
run: |
|
|
url="$GITHUB_SERVER_URL/api/packages/${{ github.repository_owner }}/debian/pool/bookworm/compair/upload"
|
|
echo "api url: $url"
|
|
|
|
debver="${UPSTREAM_VER}-${EXTRA_VER}"
|
|
debfile="_packages/${PKGNAME}_${debver}.deb"
|
|
echo "uploading file: $debfile"
|
|
|
|
curl --fail-with-body \
|
|
-X PUT \
|
|
--user "oauth2:${{ secrets.PACKAGE_REGISTRY_TOKEN }}" \
|
|
--upload-file "$debfile" \
|
|
"$url"
|
|
|
|
echo "final url: $GITHUB_SERVER_URL/${{ github.repository_owner }}/-/packages/debian/${PKGNAME}/${debver}"
|