Repository navigation
104 lines (92 loc) · 2.88 KB
/
Copy pathdocker.yml
File metadata and controls
104 lines (92 loc) · 2.88 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Builds and smoke-tests the image on every relevant pull request, and publishes
# it to GHCR only for a v* tag. Pushes to main leave the registry alone, so
# `latest` always means the newest release, never whatever main happens to be.
name: Image
on:
push:
tags: ["v*"]
pull_request:
paths:
- docker/**
- server/**
- shared/**
- src/**
- public/**
- index.html
- package.json
- pnpm-lock.yaml
- tsconfig.json
- vite.config.ts
- .dockerignore
- scripts/smoke.sh
- .github/workflows/docker.yml
workflow_dispatch:
permissions:
contents: read
packages: write
concurrency:
group: image-${{ github.ref }}
cancel-in-progress: true
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# GHCR rejects capitals, and the owner here is FrrCode.
- name: Image name
run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
# X.Y.Z, X.Y and (for non-prereleases) latest, plus the commit.
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
# Single-arch and loaded into the local daemon, so the smoke test runs the
# exact image about to be published.
- name: Build for the smoke test
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
load: true
tags: timeinator:smoke
build-args: VERSION=${{ steps.meta.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Smoke test
run: scripts/smoke.sh timeinator:smoke
- name: Log in to GHCR
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push (amd64, arm64)
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: VERSION=${{ steps.meta.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Summary
if: startsWith(github.ref, 'refs/tags/v')
env:
TAGS: ${{ steps.meta.outputs.tags }}
run: |
{
echo "### Published"
echo
printf -- '- `%s`\n' $TAGS
} >> "$GITHUB_STEP_SUMMARY"