Skip to content

Merge pull request #12 from pluja/master #23

Merge pull request #12 from pluja/master

Merge pull request #12 from pluja/master #23

name: Build site and push custom image
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
extended: true
- name: Build site
run: hugo --destination ./public
- name: Install zopfli
run: sudo apt-get install -y --no-install-recommends zopfli
- name: Compress public static files
run: |
cd public
for file in $(find . -type f)
do
zopfli "$file"
rm "$file"
touch -r "$file".gz "$file"
done
- name: Build and push to Github Packages Docker Registry
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/silentpaymentsxyz:latest
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/silentpaymentsxyz:latest
cache-to: type=inline
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}