From 01a813ea587e0be9b1ef9be271e7941ddfb2f5f0 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Fri, 5 Apr 2024 22:14:45 +0200 Subject: [PATCH] experimental new pipeline --- .forgejo/workflows/build.yml | 61 +++++++++++++++++++++++++++++++++ .forgejo/workflows/renovate.yml | 24 +++++++++++++ .renovaterc.json | 3 +- .woodpecker/1-renovate.yml | 21 ------------ .woodpecker/2-build.yml | 34 ------------------ 5 files changed, 87 insertions(+), 56 deletions(-) create mode 100644 .forgejo/workflows/build.yml create mode 100644 .forgejo/workflows/renovate.yml delete mode 100644 .woodpecker/1-renovate.yml delete mode 100644 .woodpecker/2-build.yml diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 00000000000..fa2f385884c --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,61 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: Build/Publish XBPS + +on: + push: + paths-ignore: + - ".forgejo**" + - ".renovaterc.json" + - "README.md" + +jobs: + build-and-publish: + runs-on: docker + container: git.snaile.de/snailed/xbps-builder:2024.4.2029 + env: + MAINTAINER: "Luca Bilke " + ARCH: "x86_64" + steps: + - name: Checkout + uses: https://code.forgejo.org/actions/checkout@v4 + with: + submodules: true + + - name: Get changed packages + id: changed + uses: https://github.com/tj-actions/changed-files@v44 + with: + since_last_remote_commit: true + + - name: Build packages + run: | + set -xeu + packages=$(echo "${{ steps.changed.outputs.all_changed_files }}" | grep -oP '(?<=srcpkgs/)[^/]*' | xargs) + [ -z "${packages}" ] && exit 0 + export XBPS_TARGET_ARCH + for package in $packages; do + cp -a "srcpkgs/${package}" "/void-packages-master/srcpkgs/" + /void-packages-master/xbps-src pkg "${package}" >"pkg.log" + mv "/void-packages-master/hostdir/binpkgs/${package}.${{ env.ARCH }}.xbps" "/target/" + done + + - name: Push packages + run: | + set -xeu + + packages=$(echo "${{ steps.changed.outputs.all_changed_files }}" | grep -oP '(?<=srcpkgs/)[^/]*' | xargs) + [ -z "${packages}" ] && exit 0 + + curl -so "/target/${{ env.ARCH }}-repodata" "https://xbps.snaile.de/${{ env.ARCH }}-repodata" + echo '${{ secrets.XBPS_SIGNING_KEY }}' >"/tmp/privkey.pem" + + for package in $packages; do + file="/target/${package}.${{ env.ARCH }}.xbps" + [ -r "$file" ] + xbps-rindex --add "$file" + XBPS_PASSPHRASE=${{ secrets.XBPS_SIGNING_PASSPHRASE }} xbps-rindex --privkey "/tmp/privkey.pem" --sign-pkg --signedby "${{ env.MAINTAINER }}" "$file" + done + + ls -lAH /target + find /target -type f -exec sh -c 'curl -X PUT --digest -u "${{ vars.XBPS_WEBDAV_USER }}:${{ secrets.XBPS_WEBDAV_KEY }}" -T "${1}" "https://xbps.snaile.de/$(basename $1)"' find-shell {} \; + rm /tmp/privkey.pem diff --git a/.forgejo/workflows/renovate.yml b/.forgejo/workflows/renovate.yml new file mode 100644 index 00000000000..f6ccf591102 --- /dev/null +++ b/.forgejo/workflows/renovate.yml @@ -0,0 +1,24 @@ +name: Renovate + +on: + schedule: + - cron: '0 */12 * * *' + +jobs: + renovate: + runs-on: docker + container: renovate/renovate@sha256:328686ec82a09ea7fc4326ac03a35dff926a7e85206d7f1b376d6002e04ef526 + env: + RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }} + GITHUB_COM_TOKEN: ${{ secrets.GH_NOPRIV_TOKEN }} + RENOVATE_GIT_PRIVATE_KEY: ${{ secrets.JOHNNY5_GPG_PRIVKEY }} + RENOVATE_PLATFORM: gitea + RENOVATE_ENDPOINT: ${{ github.server_url }} + RENOVATE_GIT_AUTHOR: 'Johnny5 ' + LOG_LEVEL: debug + + steps: + - uses: https://code.forgejo.org/actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + + - name: Renovate + run: renovate ${{ github.repository }} diff --git a/.renovaterc.json b/.renovaterc.json index b6a3eb71f93..c246107ef9b 100644 --- a/.renovaterc.json +++ b/.renovaterc.json @@ -32,6 +32,7 @@ } ], "enabledManagers": [ - "custom.regex" + "custom.regex", + "github-actions" ] } diff --git a/.woodpecker/1-renovate.yml b/.woodpecker/1-renovate.yml deleted file mode 100644 index 21cd2d23620..00000000000 --- a/.woodpecker/1-renovate.yml +++ /dev/null @@ -1,21 +0,0 @@ -when: - - event: cron - cron: renovate - - event: manual - -steps: - renovate: - image: renovate/renovate - commands: - - renovate $${CI_REPO} - environment: - RENOVATE_PLATFORM: ${CI_FORGE_TYPE} - RENOVATE_ENDPOINT: ${CI_FORGE_URL} - RENOVATE_GIT_AUTHOR: Renovate Bot - secrets: - - source: github_token - target: github_com_token - - source: gitea_renovate - target: renovate_token - - source: renovate_git_private_key - target: RENOVATE_GIT_PRIVATE_KEY diff --git a/.woodpecker/2-build.yml b/.woodpecker/2-build.yml deleted file mode 100644 index 0be4569ac35..00000000000 --- a/.woodpecker/2-build.yml +++ /dev/null @@ -1,34 +0,0 @@ -matrix: - PACKAGE: - - brave-bin - - tidal-hifi-bin - - ferdium-bin - - font-firacode-nf-ttf - - zk - -when: - - event: push - evaluate: 'CI_PIPELINE_FILES contains PACKAGE && CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH' - - event: manual - -steps: - package-xbps: - image: git.snaile.de/snailed/xbps-builder:latest - pull: true - environment: - - XBPS_TARGET_ARCH=x86_64 - secrets: - - source: xbps_pem_passphrase - target: XBPS_PASSPHRASE - volumes: - - /var/www/xbps:/target - - /etc/woodpecker/:/etc/woodpecker:ro - commands: - - export XBPS_TARGET_ARCH - - cp -a srcpkgs/${PACKAGE} /void-packages-master/srcpkgs/ - - /void-packages-master/xbps-src binary-bootstrap - - /void-packages-master/xbps-src pkg ${PACKAGE} > pkg.log - - "packagename=$(cat pkg.log | grep 'index: added' | cut -d '`' -f2 | cut -d \"'\" -f1)" - - mv /void-packages-master/hostdir/binpkgs/$${packagename}.x86_64.xbps /target/ - - xbps-rindex -a /target/$${packagename}.x86_64.xbps - - xbps-rindex -S --signedby "$${CI_COMMIT_AUTHOR} <$${CI_COMMIT_AUTHOR_EMAIL}>" --privkey /etc/woodpecker/privkey.pem /target/*.xbps