Skip to content

Commit 68e13c7

Browse files
committed
Create a separate workflow for PRs
1 parent b6cd790 commit 68e13c7

2 files changed

Lines changed: 42 additions & 2 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Create a Docker image
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build-and-push-image:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v5
19+
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Extract metadata (tags, labels) for Docker
27+
id: meta
28+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
29+
with:
30+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
31+
tags: |
32+
type=ref,event=pr
33+
type=sha
34+
35+
- name: Build Docker image
36+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
37+
with:
38+
context: .
39+
platforms: linux/amd64,linux/arm64
40+
push: false
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/PublishDockerImage.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ on:
55
branches: ['main']
66
tags:
77
- 'v*.*.*'
8-
pull_request:
9-
types: [opened, synchronize, reopened]
108

119
env:
1210
REGISTRY: ghcr.io

0 commit comments

Comments
 (0)