Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit cf6bb5b

Browse files
authored
Build and publish docker
1 parent 30f61d4 commit cf6bb5b

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build, publish and deploy docker
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
tags:
7+
- 'v*'
8+
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build-and-push-image:
16+
name: Build and push
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v2
25+
26+
- name: Log in to the Container registry
27+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
tags: |
39+
type=ref,event=tag,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
40+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
41+
type=raw,value=test,enable=true
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
45+
with:
46+
context: .
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)