Denys Konovalov
856b3310dd
All checks were successful
Pagefind Update Check / update-check (push) Successful in 1s
40 lines
2.1 KiB
YAML
40 lines
2.1 KiB
YAML
name: Pagefind Update Check
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
schedule:
|
|
- cron: '@daily'
|
|
|
|
jobs:
|
|
update-check:
|
|
runs-on: act-runner-user
|
|
steps:
|
|
- name: Check Pagefind version
|
|
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
|
|
|
|
- name: Update Pagefind package
|
|
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')
|
|
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
|
|
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
|
|
|
|
- name: Deploy
|
|
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')
|
|
curl -sL https://git.cantorgymnasium.de/api/packages/gcg/generic/pagefind/$NEWEST_PAGEFIND_RELEASE/pagefind_extended --output /usr/local/bin/pagefind_extended
|
|
|
|
- name: Notification
|
|
uses: actions/telegram-action@main
|
|
if: always() && steps.check.outputs.update_available == 1
|
|
with:
|
|
chat_id: ${{ secrets.TG_CHAT_ID }}
|
|
token: ${{ secrets.TG_TOKEN }}
|