-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (36 loc) · 1.26 KB
/
ghcr-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
name: Build and publish Docker image to ghcr
on: push
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# For convenience, tag builds with the branch name and/or tag name where applicable.
# For reproducibility, also tag builds with a unique build id.
tags: |
type=ref,priority=3,event=tag
type=ref,priority=2,event=branch
type=raw,priority=1,value=build-${{github.run_id}}-attempt-${{github.run_attempt}}
- name: Build and push the image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true