2024-07-05 20:31:23 +02:00
|
|
|
name: Pagefind Update Check
|
2023-12-22 18:11:48 +01:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-07-05 20:31:23 +02:00
|
|
|
branches: [main]
|
2023-12-22 18:11:48 +01:00
|
|
|
schedule:
|
2024-07-05 20:31:23 +02:00
|
|
|
- cron: '@daily'
|
2023-12-22 18:11:48 +01:00
|
|
|
|
|
|
|
jobs:
|
2024-07-05 20:31:23 +02:00
|
|
|
update-check:
|
2024-07-07 11:52:14 +02:00
|
|
|
name: Update-Check
|
2023-12-22 18:11:48 +01:00
|
|
|
runs-on: act-runner-user
|
|
|
|
steps:
|
2024-07-07 11:17:07 +02:00
|
|
|
- name: Check Pagefind version
|
2023-12-22 18:11:48 +01:00
|
|
|
id: check
|
|
|
|
run: |
|
|
|
|
export NEWEST_PAGEFIND_RELEASE=$(curl -s https://api.github.com/repos/CloudCannon/pagefind/releases | jq -r '.[0].name')
|
|
|
|
export CURRENT_PAGEFIND_RELEASE=$(curl --user ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} https://git.cantorgymnasium.de/api/v1/packages/gcg | jq -r 'map(select( .name | contains("pagefind"))) | .[0].version')
|
|
|
|
echo update_available=$(! [[ $NEWEST_PAGEFIND_RELEASE != $CURRENT_PAGEFIND_RELEASE ]]; echo $?) >> $GITHUB_OUTPUT
|
|
|
|
|
2024-07-07 11:17:07 +02:00
|
|
|
- name: Update Pagefind package
|
2023-12-22 18:11:48 +01:00
|
|
|
if: steps.check.outputs.update_available == 1
|
|
|
|
run: |
|
|
|
|
export NEWEST_PAGEFIND_RELEASE=$(curl -s https://api.github.com/repos/CloudCannon/pagefind/releases | jq -r '.[0].name')
|
2023-12-22 18:15:05 +01:00
|
|
|
curl -LO https://github.com/CloudCannon/pagefind/releases/download/$(echo $NEWEST_PAGEFIND_RELEASE)/pagefind_extended-$(echo $NEWEST_PAGEFIND_RELEASE)-x86_64-unknown-linux-musl.tar.gz
|
|
|
|
tar -xf pagefind_extended-$(echo $NEWEST_PAGEFIND_RELEASE)-x86_64-unknown-linux-musl.tar.gz
|
2023-12-22 18:16:27 +01:00
|
|
|
curl --user ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} --upload-file pagefind_extended https://git.cantorgymnasium.de/api/packages/gcg/generic/pagefind/$NEWEST_PAGEFIND_RELEASE/pagefind_extended
|
2023-12-22 18:11:48 +01:00
|
|
|
|
2024-07-07 11:17:07 +02:00
|
|
|
- name: Deploy
|
2023-12-22 18:11:48 +01:00
|
|
|
if: steps.check.outputs.update_available == 1
|
|
|
|
run: |
|
|
|
|
export NEWEST_PAGEFIND_RELEASE=$(curl -s https://api.github.com/repos/CloudCannon/pagefind/releases | jq -r '.[0].name')
|
2023-12-22 18:16:27 +01:00
|
|
|
curl -sL https://git.cantorgymnasium.de/api/packages/gcg/generic/pagefind/$NEWEST_PAGEFIND_RELEASE/pagefind_extended --output /usr/local/bin/pagefind_extended
|
2023-12-22 18:12:33 +01:00
|
|
|
|
2024-07-07 11:17:07 +02:00
|
|
|
- name: Notification
|
2023-12-22 18:12:33 +01:00
|
|
|
uses: actions/telegram-action@main
|
2024-07-07 11:18:27 +02:00
|
|
|
if: always() && steps.check.outputs.update_available == 1
|
2023-12-22 18:12:33 +01:00
|
|
|
with:
|
|
|
|
chat_id: ${{ secrets.TG_CHAT_ID }}
|
2024-07-05 20:31:23 +02:00
|
|
|
token: ${{ secrets.TG_TOKEN }}
|