-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (43 loc) · 1.22 KB
/
build.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
name: Create and publish a Docker image
on:
push:
branches:
- master
release:
types: ['published']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-22.04
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
#
steps:
- uses: docker/[email protected]
with:
driver-opts: image=moby/buildkit
- uses: docker/[email protected]
id: meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha,format=long
type=semver,pattern={{version}}
- uses: docker/[email protected]
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/[email protected]
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max