-
Notifications
You must be signed in to change notification settings - Fork 5
63 lines (54 loc) · 1.52 KB
/
docker-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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:
WRITEFREELY_VERSION: v0.15.0
DOCKERHUB_REPO: jrasanen/writefreely
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
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
labels: ${{ steps.meta.outputs.labels }}
build-args: |
WRITEFREELY_VERSION=${{ env.WRITEFREELY_VERSION }}
tags: |
${{ env.DOCKERHUB_REPO }}:${{ env.WRITEFREELY_VERSION }}
${{ env.DOCKERHUB_REPO }}:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max