Fix WF #387
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Hugo build and deploy | |
on: | |
schedule: | |
- cron: "0 3 * * *" | |
push: | |
branches: ["main"] | |
tags: ["v*.*.*"] | |
pull_request: | |
branches: ["main"] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
environment: Docker | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "0.119.0" | |
extended: true | |
- name: Build | |
run: hugo --gc --minify | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
if: github.event.name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
if: github.event.name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Extract docker metadata | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push | |
id: build-and-push | |
uses: docker/[email protected] | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: | | |
ghcr.io/Buterland-Beckerhook/buterland-beckerhook:latest | |
ghcr.io/Buterland-Beckerhook.buterland-beckerhook:${{ github.sha }} | |
${{ secrets.DOCKER_USER }}/buterland-beckerhook:latest | |
${{ secrets.DOCKER_USER }}/buterland-beckerhook:${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |