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

135 lines
4.5 KiB
YAML

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build/Publish XBPS
on:
push:
branches:
- "master"
paths:
- "srcpkgs/dmenu-custom/**"
- "srcpkgs/dwm-custom/**"
- "srcpkgs/dwmblocks-custom/**"
- "srcpkgs/font-firacode-nf-ttf/**"
- "srcpkgs/kdash/**"
- "srcpkgs/pv-migrate/**"
- "srcpkgs/st-custom/**"
- "srcpkgs/tokyonight-icon-theme/**"
- "srcpkgs/tokyonight-theme/**"
- "srcpkgs/trash-util/**"
- "srcpkgs/velero/**"
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: x86_64-musl
host: x86_64-musl
libc: musl
platform: linux/amd64
- arch: aarch64-musl
host: x86_64-musl
libc: musl
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: 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@bd3615a6e9d5546151e17d72193eea0d6f297398 # 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 "${HOME}/hostdir/binpkgs"
- name: Get changed packages
run: |
tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
*" "*" "*) tip="${tip##* }" ;;
*) 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); do
XBPS_ARCH="${{ matrix.config.arch }}" 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
echo -e '\x1b[32mUploading '"${item}"'...\x1b[0m'
curl -s -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