65 lines
1.8 KiB
YAML
65 lines
1.8 KiB
YAML
name: Build Blog
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main # Set a branch to deploy
|
|
|
|
env:
|
|
IMAGE_REGISTRY: ghcr.io
|
|
IMAGE_OWNER: fluttershub
|
|
IMAGE_NAME: blog
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-18.04
|
|
strategy:
|
|
matrix:
|
|
CPU_ARCH:
|
|
- arm64
|
|
- x86_64
|
|
# If running with act, Uncomment below
|
|
container: phaze9/action-runner
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
|
|
|
- name: Setup Hugo
|
|
uses: peaceiris/actions-hugo@v2
|
|
with:
|
|
hugo-version: '0.83.1'
|
|
extended: true
|
|
|
|
- name: Build
|
|
run: cd src && hugo --minify --destination build/
|
|
|
|
- name: Setup Docker
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to ghcr.io
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push - x64
|
|
id: docker_build_x64
|
|
uses: docker/build-push-action@v2
|
|
if: ${{ matrix.CPU_ARCH == 'x86_64'}}
|
|
with:
|
|
push: true
|
|
platforms: linux/amd64
|
|
labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
|
|
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:x64-latest
|
|
|
|
- name: Build and push - arm64
|
|
id: docker_build_arm64
|
|
uses: docker/build-push-action@v2
|
|
if: ${{ matrix.CPU_ARCH == 'arm64'}}
|
|
with:
|
|
push: true
|
|
platforms: linux/arm64
|
|
labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
|
|
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:arm-latest |