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

123 lines
4.1 KiB
YAML

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build/Publish XBPS
on:
push:
branches:
- "master"
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]')"
strategy:
fail-fast: false
matrix:
config:
- arch: x86_64
host: x86_64
libc: glibc
platform: linux/amd64
- arch: i686
host: i686
libc: glibc
platform: linux/386
- arch: aarch64
host: x86_64
libc: glibc
platform: linux/amd64
- arch: armv7l
host: x86_64
libc: glibc
platform: linux/amd64
- arch: x86_64-musl
host: x86_64-musl
libc: musl
platform: linux/amd64
- arch: armv6l-musl
host: x86_64-musl
libc: musl
platform: linux/amd64
- arch: aarch64-musl
host: x86_64-musl
libc: musl
platform: linux/amd64
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 }}"
HOSTREPO: /hostrepo
container:
image: git.snaile.de/snailed/xbps-builder:${{ matrix.config.libc }}-latest
steps:
- name: Clone and checkout
uses: https://github.com/classabbyamp/treeless-checkout-action@v1
- 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
xbps-install -Syu || { xbps-install -yu xbps && xbps-install -yu; }
xbps-install -y grep curl git
- 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
- 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
- name: Build packages
run: |
(
here="$(pwd)"
cd /
"$here/common/travis/build.sh" "$BOOTSTRAP" "$ARCH" 0
)
- name: Sign and upload packages
run: |
echo '${{ secrets.XBPS_SIGNING_KEY }}' >"/tmp/privkey.pem"
for package in $(echo "$HOME"/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
done
rm /tmp/privkey.pem