diff --git a/.github/act-aur-event.json b/.github/act-aur-event.json deleted file mode 100644 index 113bbba..0000000 --- a/.github/act-aur-event.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "inputs": { - "version": "v1.41.1", - "dry_run": "true" - }, - "repository": { - "name": "kst4contest", - "full_name": "praktimarc/kst4contest" - } -} diff --git a/.github/act-tag-event.json b/.github/act-tag-event.json deleted file mode 100644 index 16bf132..0000000 --- a/.github/act-tag-event.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "ref": "refs/tags/1.41", - "ref_name": "1.41", - "repository": { - "name": "kst4contest", - "full_name": "praktimarc/kst4contest" - } -} diff --git a/.github/workflows/aur-nightly-git.yml b/.github/workflows/aur-nightly-git.yml new file mode 100644 index 0000000..19fb306 --- /dev/null +++ b/.github/workflows/aur-nightly-git.yml @@ -0,0 +1,99 @@ +name: AUR Nightly (kst4contest-git) + +on: + workflow_run: + workflows: ["Nightly Runtime Artifacts"] + types: [completed] + workflow_dispatch: + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + update-aur-git: + if: >- + github.event_name == 'workflow_dispatch' || + github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + container: + image: archlinux:latest + + steps: + - name: Install dependencies + run: | + pacman -Sy --noconfirm git openssh base-devel + useradd -m builder + + - name: Checkout + uses: actions/checkout@v4.1.7 + with: + fetch-depth: 0 + + - name: Compute pkgver + id: ver + run: | + BASE=$(grep -m1 '' pom.xml \ + | sed 's/.*\(.*\)<\/version>.*/\1/' | sed 's/[-.]nightly//') + GIT_PKGVER="${BASE}.r$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)" + echo "pkgver=${GIT_PKGVER}" >> "$GITHUB_OUTPUT" + + - name: Update PKGBUILD + env: + PKGVER: ${{ steps.ver.outputs.pkgver }} + run: | + sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/aur/kst4contest-git/PKGBUILD + + - name: Generate .SRCINFO + run: | + cp -r packaging/aur/kst4contest-git /tmp/kst4contest-git + chown -R builder:builder /tmp/kst4contest-git + su builder -c "cd /tmp/kst4contest-git && makepkg --printsrcinfo > .SRCINFO" + cp /tmp/kst4contest-git/.SRCINFO packaging/aur/kst4contest-git/.SRCINFO + cat packaging/aur/kst4contest-git/.SRCINFO + + - name: Commit updated PKGBUILD to repo + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" + git add packaging/aur/kst4contest-git/ + git diff --cached --quiet && echo "No changes to commit." && exit 0 + git commit -m "chore: update kst4contest-git to ${{ steps.ver.outputs.pkgver }} [skip ci]" + git push + + - name: Set up AUR SSH + env: + AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + run: | + mkdir -p ~/.ssh + printf '%s\n' "${AUR_SSH_PRIVATE_KEY}" > ~/.ssh/aur_ed25519 + chmod 600 ~/.ssh/aur_ed25519 + ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts + cat >> ~/.ssh/config << 'EOF' + Host aur.archlinux.org + IdentityFile ~/.ssh/aur_ed25519 + User aur + EOF + + - name: Push to AUR + run: | + git config --global user.email "philipp@wagnersnetz.de" + git config --global user.name "Philipp Wagner" + + AUR_DIR="/tmp/aur/kst4contest-git" + git clone "ssh://aur@aur.archlinux.org/kst4contest-git.git" "${AUR_DIR}" 2>/dev/null || { + mkdir -p "${AUR_DIR}" + git -C "${AUR_DIR}" init + git -C "${AUR_DIR}" remote add origin "ssh://aur@aur.archlinux.org/kst4contest-git.git" + } + + cp packaging/aur/kst4contest-git/PKGBUILD "${AUR_DIR}/" + cp packaging/aur/kst4contest-git/.SRCINFO "${AUR_DIR}/" + git -C "${AUR_DIR}" add PKGBUILD .SRCINFO + git -C "${AUR_DIR}" diff --cached --quiet \ + && echo "kst4contest-git: no changes, skipping push" && exit 0 + git -C "${AUR_DIR}" commit -m "Update pkgver to ${{ steps.ver.outputs.pkgver }}" + git -C "${AUR_DIR}" push origin HEAD:master + echo "kst4contest-git: pushed to AUR" diff --git a/packaging/aur/kst4contest-git/PKGBUILD b/packaging/aur/kst4contest-git/PKGBUILD index f32cba4..937106b 100644 --- a/packaging/aur/kst4contest-git/PKGBUILD +++ b/packaging/aur/kst4contest-git/PKGBUILD @@ -15,9 +15,9 @@ sha256sums=('SKIP') pkgver() { cd "${srcdir}/kst4contest" - git describe --long --tags 2>/dev/null \ - | sed 's/^v//;s/\([^-]*-g[0-9a-f]*\)/r\1/;s/-/./g' \ - || printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + BASE=$(grep -m1 '' pom.xml \ + | sed 's/.*\(.*\)<\/version>.*/\1/' | sed 's/[-.]nightly//') + printf '%s.r%s.g%s' "${BASE}" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } build() {