2022-05-10 20:41:03 +03:00
|
|
|
name: Docker
|
|
|
|
|
|
|
|
on:
|
2024-05-19 15:50:15 +03:00
|
|
|
workflow_dispatch:
|
2022-05-10 20:41:03 +03:00
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
tags: [ 'v*.*.*' ]
|
2024-05-19 15:50:15 +03:00
|
|
|
schedule:
|
|
|
|
- cron: '37 1 * * *'
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2022-05-10 20:41:03 +03:00
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
2024-05-19 16:36:41 +03:00
|
|
|
WRITEFREELY_VERSION: v0.15.0
|
2022-05-10 20:41:03 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
steps:
|
2024-05-19 15:50:15 +03:00
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v4
|
2022-05-10 20:41:03 +03:00
|
|
|
|
|
|
|
- name: Log in to Docker Hub
|
2024-05-19 15:50:15 +03:00
|
|
|
uses: docker/login-action@v3
|
2022-05-10 20:41:03 +03:00
|
|
|
with:
|
2024-05-19 15:50:15 +03:00
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2022-05-10 20:41:03 +03:00
|
|
|
|
2024-05-19 15:50:15 +03:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
2024-05-19 16:36:41 +03:00
|
|
|
- uses: actions/cache@v3
|
2022-05-10 20:41:03 +03:00
|
|
|
with:
|
2024-05-19 16:36:41 +03:00
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2022-05-10 20:41:03 +03:00
|
|
|
|
2024-05-19 15:50:15 +03:00
|
|
|
- name: Build and Push
|
|
|
|
uses: docker/build-push-action@v5
|
2022-05-10 20:41:03 +03:00
|
|
|
with:
|
|
|
|
context: .
|
2024-05-19 15:50:15 +03:00
|
|
|
file: ./Dockerfile
|
2022-05-10 20:41:03 +03:00
|
|
|
push: true
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2024-05-19 16:36:41 +03:00
|
|
|
build-args: |
|
|
|
|
WRITEFREELY_VERSION=${{ env.WRITEFREELY_VERSION }}
|
|
|
|
tags: |
|
|
|
|
${{ env.DOCKERHUB_REPO }}:${{ env.WRITEFREELY_VERSION }}
|
|
|
|
${{ env.DOCKERHUB_REPO }}:latest
|
2024-05-19 15:50:15 +03:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2024-05-19 16:36:41 +03:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|