Skip to content

Commit de9667a

Browse files
authored
Merge pull request #545 from allthingslinux/tess-docker-ghcr
Create docker-image.yml
2 parents 962d98d + 8ba6eaf commit de9667a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/docker-image.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Create and Publish Docker Image CI
2+
3+
4+
on:
5+
push:
6+
branches: [ "main" ]
7+
pull_request:
8+
9+
jobs:
10+
11+
docker:
12+
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Docker meta
20+
id: meta
21+
uses: docker/metadata-action@v5
22+
with:
23+
images: |
24+
ghcr.io/allthingslinux/tux
25+
tags: |
26+
type=raw,value=latest,enable={{is_default_branch}}
27+
type=ref,event=pr
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
- name: Login to GHCR
31+
if: github.event_name != 'pull_request'
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
- name: Build and push
38+
uses: docker/build-push-action@v6
39+
with:
40+
push: ${{ github.event_name != 'pull_request' }}
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)