1
0
forked from BgLUG/bglug.it
bglug.it/.gitea/workflows/build_and_push.yaml
paspo 267843eb1a add footer commit info (#188)
![image](/attachments/9729d5ac-76ef-4aa8-9da0-227d0475f31d)

il link porta https://git.libreschool.org/BgLUG/bglug.it/commits/branch/main

Reviewed-on: BgLUG/bglug.it#188
Reviewed-by: omar <omarl@noreply.libreschool.org>
Co-authored-by: paspo <paolo@asperti.com>
Co-committed-by: paspo <paolo@asperti.com>
2024-08-06 20:04:00 +00:00

79 lines
2.3 KiB
YAML

---
name: Container Publish
on:
push:
tags:
- 'live'
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
- uses: actions/cache/restore@v4
with:
path: |
resources
key: bglug-it-hugo-resources
- name: update git hash
run: |
H=$(git rev-parse --short=10 HEAD)
sed -i 's/AbbreviatedHash\.*/AbbreviatedHash: $H/' config/_default/params.yaml
- name: Build Hugo
uses: lowply/build-hugo@v0.129.0
with:
args: --gc --minify --cleanDestinationDir
- uses: actions/cache/save@v4
if: always() # salva in cache anche se la build fallisce
with:
path: |
resources
key: bglug-it-hugo-resources
- 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
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: git.libreschool.org/bglug/bglug.it:latest
- 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
- name: notify running live image
run: |
set -x
curl -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" https://bglug.it/v1/update