writefreely-docker/.github/workflows/docker-publish.yml
2024-05-19 15:50:15 +03:00

58 lines
1.3 KiB
YAML

name: Docker
on:
workflow_dispatch:
push:
branches: [ main ]
tags: [ 'v*.*.*' ]
schedule:
- cron: '37 1 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
jrasanen/writefreely
ghcr.io/${{ github.repository }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ steps.meta.outputs.tags }}
${{ env.DOCKERHUB_REPO }}:latest
platforms: linux/amd64,linux/arm64