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

133 lines
4.4 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:
2024-05-22 20:23:53 +02:00
- "srcpkgs/font-firacode-nf-ttf/**"
2024-05-22 18:57:48 +02:00
- "srcpkgs/dmenu-custom/**"
- "srcpkgs/dwm-custom/**"
- "srcpkgs/st-custom/**"
- "srcpkgs/dwmblocks-custom/**"
2024-05-23 15:16:44 +02:00
- "srcpkgs/tokyonight-icon-theme/**"
2024-05-23 15:43:16 +02:00
- "srcpkgs/tokyonight-theme/**"
2024-05-23 16:37:40 +02:00
- "srcpkgs/trash-util/**"
- "srcpkgs/snailedesktop/**"
2024-05-21 18:28:51 +02:00
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
2024-05-21 21:41:35 +02:00
# - 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
2024-05-21 18:28:51 +02:00
container:
image: git.snaile.de/snailed/xbps-builder:${{ matrix.config.libc }}-latest
2024-05-21 18:28:51 +02:00
steps:
2024-05-21 18:44:39 +02:00
- name: Clone and checkout
uses: https://github.com/classabbyamp/treeless-checkout-action@bd3615a6e9d5546151e17d72193eea0d6f297398 # 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
2024-05-22 20:03:45 +02:00
mkdir -p "${HOME}/hostdir/binpkgs"
2024-05-21 18:28:51 +02:00
2024-05-21 19:24:11 +02:00
- 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
2024-05-21 18:28:51 +02:00
- name: Build packages
run: |
(
here="$(pwd)"
cd /
2024-05-21 21:20:02 +02:00
"$here/common/travis/build.sh" "$BOOTSTRAP" "$ARCH" 0
2024-05-21 18:28:51 +02:00
)
2024-05-22 20:03:45 +02:00
ls -lAH "${HOME}/hostdir/binpkgs"
2024-05-21 18:28:51 +02:00
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-22 21:00:01 +02:00
for package in $(echo "$HOME"/hostdir/binpkgs/*.${{ matrix.config.arch }}.xbps); do
2024-05-22 20:03:45 +02:00
XBPS_ARCH="${{ matrix.config.arch }}" XBPS_PASSPHRASE="${{ secrets.XBPS_SIGNING_PASSPHRASE }}" xbps-rindex --privkey "/tmp/privkey.pem" --sign-pkg --signedby "${{ env.MAINTAINER }}" "$package"
2024-05-21 18:44:39 +02:00
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