diff --git a/.forgejo/actions/update-aur-package/action.yaml b/.forgejo/actions/update-aur-package/action.yaml new file mode 100644 index 0000000..d90d696 --- /dev/null +++ b/.forgejo/actions/update-aur-package/action.yaml @@ -0,0 +1,123 @@ +name: Update AUR package +description: Build, test and optionally publish an AUR package + +inputs: + package-name: + description: AUR package name + required: true + upstream-version: + description: Upstream version + required: true + aur-version: + description: Current AUR package version + required: true + test-command: + description: Command(s) used to test the installed package + required: true + commit-message: + description: Git commit message + required: false + default: bumped package version + notify-message: + description: Pushover success message + required: true + git-package: + description: Treat the package as a VCS/git package and publish when PKGBUILD or .SRCINFO changes + required: false + default: 'false' + +runs: + using: composite + steps: + - name: Install dependencies + shell: bash + run: yay -Sy --needed --noconfirm --noprogressbar curl jq namcap openssh git + + - name: Setup SSH + shell: bash + env: + AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + run: | + mkdir -p ~/.ssh + echo "$AUR_SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts + chmod 644 ~/.ssh/known_hosts + + - name: Clone AUR repository + shell: bash + run: git clone "ssh://aur@aur.archlinux.org/${{ inputs.package-name }}.git" + + - name: Update package + id: update + shell: bash + working-directory: /workspace/xengi/archlinux-aur/${{ inputs.package-name }} + run: | + if [ "${{ inputs.git-package }}" != "true" ]; then + sed -i "s/^pkgver=.*/pkgver=${{ inputs.upstream-version }}/" PKGBUILD + + if [ "${{ inputs.upstream-version }}" != "${{ inputs.aur-version }}" ]; then + sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD + fi + fi + + updpkgsums + makepkg --printsrcinfo > .SRCINFO + + if [ "${{ inputs.git-package }}" = "true" ] && + ! git diff --quiet -- PKGBUILD .SRCINFO; then + echo "modified=yes" >> "$FORGEJO_OUTPUT" + fi + + - name: Test package + shell: bash + working-directory: /workspace/xengi/archlinux-aur/${{ inputs.package-name }} + run: | + makepkg -csi --noconfirm --noprogressbar + namcap -i PKGBUILD + namcap -i "${{ inputs.package-name }}-"*.pkg.tar.zst + ${{ inputs.test-command }} + + - name: Upload new package + if: ${{ inputs.git-package == 'true' && steps.update.outputs.modified == 'yes' || inputs.git-package != 'true' && inputs.upstream-version != inputs.aur-version }} + shell: bash + working-directory: /workspace/xengi/archlinux-aur/${{ inputs.package-name }} + env: + PUSHOVER_API_TOKEN: ${{ secrets.PUSHOVER_API_TOKEN }} + PUSHOVER_USER_KEY: ${{ secrets.PUSHOVER_USER_KEY }} + run: | + git config user.name "update-bot" + git config user.email "email@ricardo.band" + git commit -m "${{ inputs.commit-message }}" .SRCINFO PKGBUILD + git push + + curl -fsSL \ + --form-string "token=$PUSHOVER_API_TOKEN" \ + --form-string "user=$PUSHOVER_USER_KEY" \ + --form-string "priority=-2" \ + --form-string "sound=hey_listen" \ + --form-string "timestamp=$(date +%s)" \ + --form-string "title=AUR package ${{ inputs.package-name }}" \ + --form-string "message=${{ inputs.notify-message }}" \ + --form-string "url_title=Forgejo Pipeline" \ + --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ + https://api.pushover.net/1/messages.json + + - name: Send notification + if: ${{ failure() }} + shell: bash + env: + PUSHOVER_API_TOKEN: ${{ secrets.PUSHOVER_API_TOKEN }} + PUSHOVER_USER_KEY: ${{ secrets.PUSHOVER_USER_KEY }} + run: | + curl -sL \ + --form-string "token=$PUSHOVER_API_TOKEN" \ + --form-string "user=$PUSHOVER_USER_KEY" \ + --form-string "priority=0" \ + --form-string "sound=hey_listen" \ + --form-string "timestamp=$(date +%s)" \ + --form-string "title=AUR package ${{ inputs.package-name }} failure" \ + --form-string "message=Updating ${{ inputs.package-name }} from ${{ inputs.aur-version }} to ${{ inputs.upstream-version }} failed." \ + --form-string "url_title=Forgejo Pipeline" \ + --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ + https://api.pushover.net/1/messages.json || true diff --git a/.forgejo/workflows/packages.yaml b/.forgejo/workflows/packages.yaml index 830e22c..89476bc 100644 --- a/.forgejo/workflows/packages.yaml +++ b/.forgejo/workflows/packages.yaml @@ -7,7 +7,6 @@ on: workflow_dispatch: jobs: - # https://aur.archlinux.org/packages/go-aws-sso/ go-aws-sso: runs-on: debian-stable env: @@ -18,70 +17,20 @@ jobs: username: xengi password: ${{ secrets.REGISTRY_TOKEN }} steps: - - name: Install dependencies - run: yay -Sy --needed --noconfirm --noprogressbar curl jq namcap openssh git - name: Get versions id: versions run: | echo upstream=$(curl -fsSL -H "Authorization: Bearer ${{ secrets.GH_API_TOKEN }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/theurichde/${{ env.PACKAGE_NAME }}/releases/latest | jq -er '.tag_name | ltrimstr("v")') >> "$FORGEJO_OUTPUT" echo aur=$(curl -fsSL 'https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${{ env.PACKAGE_NAME }}' | jq -er '.results[0].Version | split("-")[0]') >> "$FORGEJO_OUTPUT" - - name: Setup SSH - run: | - mkdir -p ~/.ssh - echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - - name: Clone AUR repository - run: git clone ssh://aur@aur.archlinux.org/${{ env.PACKAGE_NAME }}.git - - name: Update package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - sed -i "s/^pkgver=.*/pkgver=${{ steps.versions.outputs.upstream }}/" PKGBUILD - if [ "${{ steps.versions.outputs.upstream }}" != "${{ steps.versions.outputs.aur }}" ]; then sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD; fi - updpkgsums - makepkg --printsrcinfo > .SRCINFO - - name: Test package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - makepkg -csi --noconfirm --noprogressbar - namcap -i PKGBUILD - namcap -i ${{ env.PACKAGE_NAME }}-*.pkg.tar.zst - go-aws-sso --help - - name: Upload new package - if: ${{ steps.versions.outputs.upstream != steps.versions.outputs.aur }} - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - git config user.name "update-bot" - git config user.email "email@ricardo.band" - git commit -m "bumped to version ${{ steps.versions.outputs.upstream }}" .SRCINFO PKGBUILD - git push - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=-2" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }}" \ - --form-string "message=${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }}" \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - - name: Send notification - if: ${{ failure() }} - run: | - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=0" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }} failure" \ - --form-string "message=Updating ${{ env.PACKAGE_NAME }} from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} failed." \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - # https://aur.archlinux.org/packages/yawsso/ + - uses: ./.forgejo/actions/update-aur-package + with: + package-name: ${{ env.PACKAGE_NAME }} + upstream-version: ${{ steps.versions.outputs.upstream }} + aur-version: ${{ steps.versions.outputs.aur }} + test-command: go-aws-sso --help + commit-message: bumped to version ${{ steps.versions.outputs.upstream }} + notify-message: ${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} + yawsso: runs-on: debian-stable env: @@ -92,70 +41,20 @@ jobs: username: xengi password: ${{ secrets.REGISTRY_TOKEN }} steps: - - name: Install dependencies - run: yay -Sy --needed --noconfirm --noprogressbar curl jq namcap openssh git - name: Get versions id: versions run: | echo upstream=$(curl -fsSL "https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json" | jq -er '.info.version') >> "$FORGEJO_OUTPUT" echo aur=$(curl -fsSL 'https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${{ env.PACKAGE_NAME }}' | jq -er '.results[0].Version | split("-")[0]') >> "$FORGEJO_OUTPUT" - - name: Setup SSH - run: | - mkdir -p ~/.ssh - echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - - name: Clone AUR repository - run: git clone ssh://aur@aur.archlinux.org/${{ env.PACKAGE_NAME }}.git - - name: Update package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - sed -i "s/^pkgver=.*/pkgver=${{ steps.versions.outputs.upstream }}/" PKGBUILD - if [ "${{ steps.versions.outputs.upstream }}" != "${{ steps.versions.outputs.aur }}" ]; then sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD; fi - updpkgsums - makepkg --printsrcinfo > .SRCINFO - - name: Test package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - makepkg -csi --noconfirm --noprogressbar - namcap -i PKGBUILD - namcap -i ${{ env.PACKAGE_NAME }}-*.pkg.tar.zst - yawsso --help - - name: Upload new package - if: ${{ steps.versions.outputs.upstream != steps.versions.outputs.aur }} - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - git config user.name "update-bot" - git config user.email "email@ricardo.band" - git commit -m "bumped to version ${{ steps.versions.outputs.upstream }}" .SRCINFO PKGBUILD - git push - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=-2" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }}" \ - --form-string "message=${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }}" \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - - name: Send notification - if: ${{ failure() }} - run: | - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=0" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }} failure" \ - --form-string "message=Updating ${{ env.PACKAGE_NAME }} from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} failed." \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - # https://aur.archlinux.org/packages/sensu-go/ + - uses: ./.forgejo/actions/update-aur-package + with: + package-name: ${{ env.PACKAGE_NAME }} + upstream-version: ${{ steps.versions.outputs.upstream }} + aur-version: ${{ steps.versions.outputs.aur }} + test-command: yawsso --help + commit-message: bumped to version ${{ steps.versions.outputs.upstream }} + notify-message: ${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} + sensu-go: runs-on: debian-stable env: @@ -166,72 +65,23 @@ jobs: username: xengi password: ${{ secrets.REGISTRY_TOKEN }} steps: - - name: Install dependencies - run: yay -Sy --needed --noconfirm --noprogressbar curl jq namcap openssh git - name: Get versions id: versions run: | echo upstream=$(curl -fsSL -H "Authorization: Bearer ${{ secrets.GH_API_TOKEN }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/sensu/${{ env.PACKAGE_NAME }}/releases/latest | jq -er '.tag_name | ltrimstr("v")') >> "$FORGEJO_OUTPUT" echo aur=$(curl -fsSL 'https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${{ env.PACKAGE_NAME }}' | jq -er '.results[0].Version | split("-")[0]') >> "$FORGEJO_OUTPUT" - - name: Setup SSH - run: | - mkdir -p ~/.ssh - echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - - name: Clone AUR repository - run: git clone ssh://aur@aur.archlinux.org/${{ env.PACKAGE_NAME }}.git - - name: Update package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - sed -i "s/^pkgver=.*/pkgver=${{ steps.versions.outputs.upstream }}/" PKGBUILD - if [ "${{ steps.versions.outputs.upstream }}" != "${{ steps.versions.outputs.aur }}" ]; then sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD; fi - updpkgsums - makepkg --printsrcinfo > .SRCINFO - - name: Test package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - makepkg -csi --noconfirm --noprogressbar - namcap -i PKGBUILD - namcap -i ${{ env.PACKAGE_NAME }}-*.pkg.tar.zst - sensu-backend --help - sensu-agent --help - sensuctl --help - - name: Upload new package - if: ${{ steps.versions.outputs.upstream != steps.versions.outputs.aur }} - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - git config user.name "update-bot" - git config user.email "email@ricardo.band" - git commit -m "bumped to version ${{ steps.versions.outputs.upstream }}" .SRCINFO PKGBUILD - git push - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=-2" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }}" \ - --form-string "message=${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }}" \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - - name: Send notification - if: ${{ failure() }} - run: | - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=0" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }} failure" \ - --form-string "message=Updating ${{ env.PACKAGE_NAME }} from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} failed." \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - # https://aur.archlinux.org/packages/cephadm/ + - uses: ./.forgejo/actions/update-aur-package + with: + package-name: ${{ env.PACKAGE_NAME }} + upstream-version: ${{ steps.versions.outputs.upstream }} + aur-version: ${{ steps.versions.outputs.aur }} + test-command: | + sensu-backend --help + sensu-agent --help + sensuctl --help + commit-message: bumped to version ${{ steps.versions.outputs.upstream }} + notify-message: ${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} + cephadm: runs-on: debian-stable env: @@ -242,70 +92,29 @@ jobs: username: xengi password: ${{ secrets.REGISTRY_TOKEN }} steps: - - name: Install dependencies - run: yay -Sy --needed --noconfirm --noprogressbar curl jq namcap openssh git - name: Get versions id: versions + shell: bash run: | - echo upstream=$(curl -fsSL https://docs.ceph.com/en/latest/releases/ | grep -oE 'latest [0-9]+\.[0-9]+\.[0-9]+' | head -n1 | cut -d' ' -f2) >> "$FORGEJO_OUTPUT" + upstream=$( + curl -fsSL https://docs.ceph.com/en/latest/releases/ | + grep -oE 'latest [0-9]+\.[0-9]+\.[0-9]+' | + head -n1 | + cut -d' ' -f2 + ) + test -n "$upstream" + echo "upstream=$upstream" >> "$FORGEJO_OUTPUT" + echo aur=$(curl -fsSL 'https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${{ env.PACKAGE_NAME }}' | jq -er '.results[0].Version | split("-")[0]') >> "$FORGEJO_OUTPUT" - - name: Setup SSH - run: | - mkdir -p ~/.ssh - echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - - name: Clone AUR repository - run: git clone ssh://aur@aur.archlinux.org/${{ env.PACKAGE_NAME }}.git - - name: Update package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - sed -i "s/^pkgver=.*/pkgver=${{ steps.versions.outputs.upstream }}/" PKGBUILD - if [ "${{ steps.versions.outputs.upstream }}" != "${{ steps.versions.outputs.aur }}" ]; then sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD; fi - updpkgsums - makepkg --printsrcinfo > .SRCINFO - - name: Test package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - makepkg -csi --noconfirm --noprogressbar - namcap -i PKGBUILD - namcap -i ${{ env.PACKAGE_NAME }}-*.pkg.tar.zst - sudo cephadm --help - - name: Upload new package - if: ${{ steps.versions.outputs.upstream != steps.versions.outputs.aur }} - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - git config user.name "update-bot" - git config user.email "email@ricardo.band" - git commit -m "bumped to version ${{ steps.versions.outputs.upstream }}" .SRCINFO PKGBUILD - git push - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=-2" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }}" \ - --form-string "message=${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }}" \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - - name: Send notification - if: ${{ failure() }} - run: | - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=0" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }} failure" \ - --form-string "message=Updating ${{ env.PACKAGE_NAME }} from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} failed." \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - # https://aur.archlinux.org/packages/cephadm-git/ + - uses: ./.forgejo/actions/update-aur-package + with: + package-name: ${{ env.PACKAGE_NAME }} + upstream-version: ${{ steps.versions.outputs.upstream }} + aur-version: ${{ steps.versions.outputs.aur }} + test-command: sudo cephadm --help + commit-message: bumped to version ${{ steps.versions.outputs.upstream }} + notify-message: ${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} + cephadm-git: runs-on: debian-stable env: @@ -316,67 +125,17 @@ jobs: username: xengi password: ${{ secrets.REGISTRY_TOKEN }} steps: - - name: Install dependencies - run: yay -Sy --needed --noconfirm --noprogressbar namcap openssh git - - name: Setup SSH - run: | - mkdir -p ~/.ssh - echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - - name: Clone AUR repository - run: git clone ssh://aur@aur.archlinux.org/${{ env.PACKAGE_NAME }}.git - - name: Update package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - id: update - run: | - updpkgsums - makepkg --printsrcinfo > .SRCINFO - if ! git diff --quiet -- PKGBUILD .SRCINFO; then - echo 'modified=yes' >> "$FORGEJO_OUTPUT" - fi - - name: Test package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - makepkg -csi --noconfirm --noprogressbar - namcap -i PKGBUILD - namcap -i ${{ env.PACKAGE_NAME }}-*.pkg.tar.zst - sudo cephadm --help - - name: Upload new package - if: steps.update.outputs.modified == 'yes' - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - git config user.name "update-bot" - git config user.email "email@ricardo.band" - git commit -m "bumped git commit" .SRCINFO PKGBUILD - git push - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=-2" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }}" \ - --form-string "message=${{ env.PACKAGE_NAME }} updated git commit" \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - - name: Send notification - if: ${{ failure() }} - run: | - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=0" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }} failure" \ - --form-string "message=Updating ${{ env.PACKAGE_NAME }} git commit failed." \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - # https://aur.archlinux.org/packages/virtualfish/ + - uses: ./.forgejo/actions/update-aur-package + with: + package-name: ${{ env.PACKAGE_NAME }} + upstream-version: '0' + aur-version: '0' + update-pkgrel: 'false' + git-package: 'true' + test-command: sudo cephadm --help + commit-message: bumped git commit + notify-message: ${{ env.PACKAGE_NAME }} updated git commit + virtualfish: runs-on: debian-stable env: @@ -387,72 +146,23 @@ jobs: username: xengi password: ${{ secrets.REGISTRY_TOKEN }} steps: - - name: Install dependencies - run: yay -Sy --needed --noconfirm --noprogressbar curl jq namcap openssh git - name: Get versions id: versions run: | echo upstream=$(curl -fsSL -H "Authorization: Bearer ${{ secrets.GH_API_TOKEN }}" https://api.github.com/repos/justinmayer/${{ env.PACKAGE_NAME }}/releases/latest | jq -er '.tag_name') >> "$FORGEJO_OUTPUT" echo aur=$(curl -fsSL 'https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${{ env.PACKAGE_NAME }}' | jq -er '.results[0].Version | split("-")[0]') >> "$FORGEJO_OUTPUT" - - name: Setup SSH - run: | - mkdir -p ~/.ssh - echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - - name: Clone AUR repository - run: git clone ssh://aur@aur.archlinux.org/${{ env.PACKAGE_NAME }}.git - - name: Update package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - sed -i "s/^pkgver=.*/pkgver=${{ steps.versions.outputs.upstream }}/" PKGBUILD - if [ "${{ steps.versions.outputs.upstream }}" != "${{ steps.versions.outputs.aur }}" ]; then sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD; fi - updpkgsums - makepkg --printsrcinfo > .SRCINFO - - name: Test package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - makepkg -csi --noconfirm --noprogressbar - namcap -i PKGBUILD - namcap -i ${{ env.PACKAGE_NAME }}-*.pkg.tar.zst - mkdir -p ~/.virtualenvs - fish -c 'vf install' - fish -c 'vf --help' - - name: Upload new package - if: ${{ steps.versions.outputs.upstream != steps.versions.outputs.aur }} - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - git config user.name "update-bot" - git config user.email "email@ricardo.band" - git commit -m "bumped to version ${{ steps.versions.outputs.upstream }}" .SRCINFO PKGBUILD - git push - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=-2" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }}" \ - --form-string "message=${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }}" \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - - name: Send notification - if: ${{ failure() }} - run: | - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=0" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }} failure" \ - --form-string "message=Updating ${{ env.PACKAGE_NAME }} from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} failed." \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - # https://aur.archlinux.org/packages/projen/ + - uses: ./.forgejo/actions/update-aur-package + with: + package-name: ${{ env.PACKAGE_NAME }} + upstream-version: ${{ steps.versions.outputs.upstream }} + aur-version: ${{ steps.versions.outputs.aur }} + test-command: | + mkdir -p ~/.virtualenvs + fish -c 'vf install' + fish -c 'vf --help' + commit-message: bumped to version ${{ steps.versions.outputs.upstream }} + notify-message: ${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} + projen: runs-on: debian-stable env: @@ -463,70 +173,20 @@ jobs: username: xengi password: ${{ secrets.REGISTRY_TOKEN }} steps: - - name: Install dependencies - run: yay -Sy --needed --noconfirm --noprogressbar curl jq namcap openssh git - name: Get versions id: versions run: | echo upstream=$(curl -fsSL https://registry.npmjs.org/${{ env.PACKAGE_NAME }} | jq -er '."dist-tags".latest') >> "$FORGEJO_OUTPUT" echo aur=$(curl -fsSL 'https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${{ env.PACKAGE_NAME }}' | jq -er '.results[0].Version | split("-")[0]') >> "$FORGEJO_OUTPUT" - - name: Setup SSH - run: | - mkdir -p ~/.ssh - echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - - name: Clone AUR repository - run: git clone ssh://aur@aur.archlinux.org/${{ env.PACKAGE_NAME }}.git - - name: Update package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - sed -i "s/^pkgver=.*/pkgver=${{ steps.versions.outputs.upstream }}/" PKGBUILD - if [ "${{ steps.versions.outputs.upstream }}" != "${{ steps.versions.outputs.aur }}" ]; then sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD; fi - updpkgsums - makepkg --printsrcinfo > .SRCINFO - - name: Test package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - makepkg -csi --noconfirm --noprogressbar - namcap -i PKGBUILD - namcap -i ${{ env.PACKAGE_NAME }}-*.pkg.tar.zst - projen --help - - name: Upload new package - if: ${{ steps.versions.outputs.upstream != steps.versions.outputs.aur }} - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - git config user.name "update-bot" - git config user.email "email@ricardo.band" - git commit -m "bumped to version ${{ steps.versions.outputs.upstream }}" .SRCINFO PKGBUILD - git push - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=-2" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }}" \ - --form-string "message=${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }}" \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - - name: Send notification - if: ${{ failure() }} - run: | - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=0" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }} failure" \ - --form-string "message=Updating ${{ env.PACKAGE_NAME }} from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} failed." \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - # https://aur.archlinux.org/packages/rqlite/ + - uses: ./.forgejo/actions/update-aur-package + with: + package-name: ${{ env.PACKAGE_NAME }} + upstream-version: ${{ steps.versions.outputs.upstream }} + aur-version: ${{ steps.versions.outputs.aur }} + test-command: projen --help + commit-message: bumped to version ${{ steps.versions.outputs.upstream }} + notify-message: ${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} + rqlite: runs-on: debian-stable env: @@ -537,70 +197,22 @@ jobs: username: xengi password: ${{ secrets.REGISTRY_TOKEN }} steps: - - name: Install dependencies - run: yay -Sy --needed --noconfirm --noprogressbar curl jq namcap openssh git - name: Get versions id: versions run: | echo upstream=$(curl -fsSL -H "Authorization: Bearer ${{ secrets.GH_API_TOKEN }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ env.PACKAGE_NAME }}/${{ env.PACKAGE_NAME }}/releases/latest | jq -er '.tag_name | ltrimstr("v")') >> "$FORGEJO_OUTPUT" echo aur=$(curl -fsSL 'https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${{ env.PACKAGE_NAME }}' | jq -er '.results[0].Version | split("-")[0]') >> "$FORGEJO_OUTPUT" - - name: Setup SSH - run: | - mkdir -p ~/.ssh - echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - - name: Clone AUR repository - run: git clone ssh://aur@aur.archlinux.org/${{ env.PACKAGE_NAME }}.git - - name: Update package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - sed -i "s/^pkgver=.*/pkgver=${{ steps.versions.outputs.upstream }}/" PKGBUILD - if [ "${{ steps.versions.outputs.upstream }}" != "${{ steps.versions.outputs.aur }}" ]; then sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD; fi - updpkgsums - makepkg --printsrcinfo > .SRCINFO - - name: Test package - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - makepkg -csi --noconfirm --noprogressbar - namcap -i PKGBUILD - namcap -i ${{ env.PACKAGE_NAME }}-*.pkg.tar.zst - rqlited --help - rqlite --help - - name: Upload new package - if: ${{ steps.versions.outputs.upstream != steps.versions.outputs.aur }} - working-directory: /workspace/xengi/archlinux-aur/${{ env.PACKAGE_NAME }} - run: | - git config user.name "update-bot" - git config user.email "email@ricardo.band" - git commit -m "bumped to version ${{ steps.versions.outputs.upstream }}" .SRCINFO PKGBUILD - git push - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=-2" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }}" \ - --form-string "message=${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }}" \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json - - name: Send notification - if: ${{ failure() }} - run: | - curl -sL \ - --form-string "token=${{ secrets.PUSHOVER_API_TOKEN }}" \ - --form-string "user=${{ secrets.PUSHOVER_USER_KEY }}" \ - --form-string "priority=0" \ - --form-string "sound=hey_listen" \ - --form-string "timestamp=$(date +%s)" \ - --form-string "title=AUR package ${{ env.PACKAGE_NAME }} failure" \ - --form-string "message=Updating ${{ env.PACKAGE_NAME }} from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} failed." \ - --form-string "url_title=Forgejo Pipeline" \ - --form-string "url=${{ env.FORGEJO_SERVER_URL }}/${{ env.FORGEJO_REPOSITORY }}/actions?workflow=packages.yaml&actor=0&status=0" \ - https://api.pushover.net/1/messages.json + - uses: ./.forgejo/actions/update-aur-package + with: + package-name: ${{ env.PACKAGE_NAME }} + upstream-version: ${{ steps.versions.outputs.upstream }} + aur-version: ${{ steps.versions.outputs.aur }} + test-command: | + rqlited --help + rqlite --help + commit-message: bumped to version ${{ steps.versions.outputs.upstream }} + notify-message: ${{ env.PACKAGE_NAME }} updated from ${{ steps.versions.outputs.aur }} to ${{ steps.versions.outputs.upstream }} + update-readme: runs-on: alpine-latest steps: @@ -620,18 +232,18 @@ jobs: ) awk -v table="$table" ' // { - print - print table - in_table = 1 - next + print + print table + in_table = 1 + next } // { - in_table = 0 - print - next + in_table = 0 + print + next } !in_table { - print + print } ' "README.md" > "README.md.new" mv "README.md.new" "README.md" @@ -645,4 +257,4 @@ jobs: exit 0 fi git commit -m "Update AUR package list" - git push \ No newline at end of file + git push