void-packages/.forgejo/workflows/publish.yaml

131 lines
4.3 KiB
YAML
Raw Normal View History

2024-05-21 18:28:51 +02:00
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build/Publish XBPS
on:
push:
branches:
2024-05-21 18:44:39 +02:00
- "master"
2024-05-21 18:28:51 +02:00
paths:
- "srcpkgs/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-publish:
name: Build and publish packages
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[ci skip]') && !contains(github.event.pull_request.body, '[ci skip]')"
env:
MAINTAINER: "Luca Bilke <luca@bil.ke>"
PATH: "/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin"
ARCH: "${{ matrix.config.arch }}"
BOOTSTRAP: "${{ matrix.config.host }}"
TEST: "${{ matrix.config.test }}"
HOSTREPO: /hostrepo
strategy:
fail-fast: false
matrix:
config:
- arch: x86_64
host: x86_64
libc: glibc
platform: linux/amd64
2024-05-21 19:24:11 +02:00
test: 0
2024-05-21 18:28:51 +02:00
- arch: i686
host: i686
libc: glibc
platform: linux/386
2024-05-21 19:24:11 +02:00
test: 0
2024-05-21 18:28:51 +02:00
- arch: aarch64
host: x86_64
libc: glibc
platform: linux/amd64
test: 0
- arch: armv7l
host: x86_64
libc: glibc
platform: linux/amd64
test: 0
- arch: x86_64-musl
host: x86_64-musl
libc: musl
platform: linux/amd64
test: 1
- arch: armv6l-musl
host: x86_64-musl
libc: musl
platform: linux/amd64
test: 0
- arch: aarch64-musl
host: x86_64-musl
libc: musl
platform: linux/amd64
test: 0
container:
image: ghcr.io/void-linux/void-buildroot-${{ matrix.config.libc }}:20231230R1
steps:
2024-05-21 18:44:39 +02:00
- name: Clone and checkout
uses: https://github.com/classabbyamp/treeless-checkout-action@v1
2024-05-21 18:28:51 +02:00
- name: Prepare container
run: |
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|repo-default|repo-ci|g' /etc/xbps.d/*-repository-*.conf
2024-05-21 18:44:39 +02:00
xbps-install -Syu || { xbps-install -yu xbps && xbps-install -yu; }
2024-05-21 19:24:11 +02:00
xbps-install -y grep curl git
2024-05-21 18:28:51 +02:00
- name: Create hostrepo and prepare masterdir
run: |
ln -s "$(pwd)" /hostrepo &&
common/travis/set_mirror.sh &&
common/travis/prepare.sh &&
common/travis/fetch-xtools.sh
mkdir -p /hostdir/binpkgs
curl -so "/hostdir/binpkgs/${{ matrix.config.arch }}-repodata" "https://xbps.snaile.de/${{ matrix.config.arch }}-repodata" || true
2024-05-21 19:24:11 +02:00
- name: Get changed packages
run: |
tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
# This is a merge commit, pick last parent
*" "*" "*) tip="${tip##* }" ;;
# This is a non-merge commit, pick itself
*) tip="${tip%% *}" ;;
esac
base="$(git rev-list -1 HEAD^)"
echo "$base $tip" >/tmp/revisions
echo -e '\x1b[32mChanged packages:\x1b[0m'
git diff-tree -r --no-renames --name-only --diff-filter=AM \
"$base" "$tip" \
-- 'srcpkgs/*/template' |
cut -d/ -f 2 |
xargs ./xbps-src sort-dependencies |
tee /tmp/templates |
sed "s/^/ /" >&2
2024-05-21 18:28:51 +02:00
- name: Build packages
run: |
(
here="$(pwd)"
cd /
"$here/common/travis/build.sh" "$BOOTSTRAP" "$ARCH" "$TEST"
)
2024-05-21 18:44:39 +02:00
- name: Sign and upload packages
2024-05-21 18:28:51 +02:00
run: |
echo '${{ secrets.XBPS_SIGNING_KEY }}' >"/tmp/privkey.pem"
2024-05-21 18:44:39 +02:00
for package in $(echo /hostdir/binpkgs/*.${{ matrix.config.arch }}.xbps | cut -d ' ' -f 1); do
XBPS_PASSPHRASE=${{ secrets.XBPS_SIGNING_PASSPHRASE }} xbps-rindex --privkey "/tmp/privkey.pem" --sign-pkg --signedby "${{ env.MAINTAINER }}" "$package"
for item in "$package" "${package}.sig2"; do
curl -X PUT --digest -u "${{ vars.XBPS_WEBDAV_USER }}:${{ secrets.XBPS_WEBDAV_KEY }}" -T "${item}" "https://xbps.snaile.de/$(basename $item)"
done
2024-05-21 18:28:51 +02:00
done
rm /tmp/privkey.pem