2024-07-05 19:58:27 +02:00
|
|
|
name: HUGO Update Check
|
2023-12-19 11:00:27 +01:00
|
|
|
|
|
|
|
on:
|
2024-07-05 20:00:07 +02:00
|
|
|
push:
|
|
|
|
branches: [main]
|
2023-12-19 11:00:27 +01:00
|
|
|
schedule:
|
2024-07-05 19:58:44 +02:00
|
|
|
- cron: '@daily'
|
2023-12-19 11:00:27 +01:00
|
|
|
|
|
|
|
jobs:
|
2024-07-05 20:02:02 +02:00
|
|
|
update-check:
|
2024-07-07 11:48:58 +02:00
|
|
|
name: Update-Check
|
2023-12-19 11:00:27 +01:00
|
|
|
runs-on: act-runner-user
|
|
|
|
steps:
|
2024-07-07 11:16:21 +02:00
|
|
|
- name: Check available HUGO version
|
2023-12-19 14:24:49 +01:00
|
|
|
id: check
|
2023-12-19 11:00:27 +01:00
|
|
|
run: |
|
2023-12-19 11:12:44 +01:00
|
|
|
export NEWEST_HUGO_RELEASE=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases | jq -r '.[0].name' | sed 's/v//g')
|
2023-12-19 11:00:27 +01:00
|
|
|
export CURRENT_HUGO_RELEASE=$(curl --user ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} https://git.cantorgymnasium.de/api/v1/packages/gcg | jq -r 'map(select( .name | contains("hugo"))) | .[0].version')
|
2023-12-19 14:24:49 +01:00
|
|
|
echo update_available=$(! [[ $NEWEST_HUGO_RELEASE != $CURRENT_HUGO_RELEASE ]]; echo $?) >> $GITHUB_OUTPUT
|
|
|
|
|
2024-07-07 11:16:21 +02:00
|
|
|
- name: Update HUGO package
|
2023-12-19 14:26:17 +01:00
|
|
|
if: steps.check.outputs.update_available == 1
|
2023-12-19 14:24:49 +01:00
|
|
|
run: |
|
|
|
|
export NEWEST_HUGO_RELEASE=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases | jq -r '.[0].name' | sed 's/v//g')
|
|
|
|
curl -LO https://github.com/gohugoio/hugo/releases/download/v$(echo $NEWEST_HUGO_RELEASE)/hugo_extended_$(echo $NEWEST_HUGO_RELEASE)_linux-amd64.deb
|
2024-07-05 19:58:27 +02:00
|
|
|
curl --user ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} --upload-file hugo_extended_$(echo $NEWEST_HUGO_RELEASE)_linux-amd64.deb https://git.cantorgymnasium.de/api/packages/gcg/debian/pool/all/main/upload
|
2024-07-07 11:18:07 +02:00
|
|
|
|
|
|
|
- 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 }}
|