2024-07-23 18:17:00 +00:00
|
|
|
---
|
2024-04-09 22:10:09 +02:00
|
|
|
name: Container Publish
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
2024-07-23 18:17:00 +00:00
|
|
|
- 'live'
|
2024-04-09 22:10:09 +02:00
|
|
|
schedule:
|
|
|
|
- cron: "0 12 * * *"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-image:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
image: catthehacker/ubuntu:act-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: true # Fetch Hugo themes (true OR recursive)
|
|
|
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
|
|
|
|
2024-07-28 09:49:36 +00:00
|
|
|
- uses: actions/cache/restore@v4
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
resources
|
|
|
|
key: bglug-it-hugo-resources
|
|
|
|
|
2024-08-06 20:04:00 +00:00
|
|
|
- name: update git hash
|
|
|
|
run: |
|
|
|
|
H=$(git rev-parse --short=10 HEAD)
|
2024-08-07 17:41:19 +00:00
|
|
|
echo "commit: $H"
|
|
|
|
sed -i "s/AbbreviatedHash\:.*$/AbbreviatedHash: ${H}/" config/_default/params.yaml
|
2024-08-06 20:04:00 +00:00
|
|
|
|
2024-07-28 09:49:36 +00:00
|
|
|
- name: Build Hugo
|
2024-10-03 06:16:07 +00:00
|
|
|
run: |
|
|
|
|
wget -O - https://github.com/gohugoio/hugo/releases/download/v0.135.0/hugo_extended_0.135.0_linux-amd64.tar.gz | tar zxv
|
|
|
|
./hugo --gc --minify --cleanDestinationDir
|
2024-07-28 09:49:36 +00:00
|
|
|
|
|
|
|
- uses: actions/cache/save@v4
|
|
|
|
if: always() # salva in cache anche se la build fallisce
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
resources
|
|
|
|
key: bglug-it-hugo-resources
|
|
|
|
|
2024-04-09 22:10:09 +02:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
|
|
|
|
- name: Set up Docker BuildX
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Login to registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: git.libreschool.org
|
|
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and publish
|
2024-06-03 22:03:26 +02:00
|
|
|
uses: docker/build-push-action@v5
|
2024-04-09 22:10:09 +02:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
2024-06-03 22:03:26 +02:00
|
|
|
platforms: linux/amd64
|
2024-04-09 22:10:09 +02:00
|
|
|
push: true
|
|
|
|
tags: git.libreschool.org/bglug/bglug.it:latest
|
2024-05-15 23:00:47 +02:00
|
|
|
|
|
|
|
- name: send mattermost notification
|
|
|
|
uses: mattermost/action-mattermost-notify@master
|
|
|
|
with:
|
|
|
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }}
|
|
|
|
TEXT: |
|
|
|
|
:white_check_mark: `${{ github.repository }}` A new container image has been pushed to `git.libreschool.org/bglug/bglug.it:latest`
|
|
|
|
MATTERMOST_ICON: https://cdn3.iconfinder.com/data/icons/system-basic-vol-4-1/20/icon-note-attention-alt3-512.png
|
2024-08-05 19:49:40 +00:00
|
|
|
|
|
|
|
- name: notify running live image
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
curl -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" https://bglug.it/v1/update
|