Skip to content

Commit 78bd4fb

Browse files
authored
chore: Fix release process to build and push docker in same workflow (#25)
GitHub Actions does not support workflows automatically triggering other workflows. This change moves the docker build and push logic into the release workflow directly.
1 parent 9fc9354 commit 78bd4fb

File tree

2 files changed

+28
-42
lines changed

2 files changed

+28
-42
lines changed

.github/workflows/build-docker.yaml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ on:
55
branches:
66
- main
77

8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
812
jobs:
913
release:
1014
runs-on: ubuntu-latest
1115

1216
permissions:
1317
contents: write
18+
packages: write
1419

1520
steps:
1621
- name: Checkout Code
@@ -29,6 +34,29 @@ jobs:
2934
create-summary: true
3035
preset: conventionalcommits
3136

37+
- name: Log in to the Container registry
38+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
39+
with:
40+
registry: ${{ env.REGISTRY }}
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Extract metadata (tags, labels) for Docker
45+
id: meta
46+
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
47+
with:
48+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
49+
50+
- name: Build and push Docker image
51+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
52+
with:
53+
context: .
54+
push: true
55+
tags: |
56+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
57+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.conventionalcommits.outputs.tag }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
3260
- name: Create Release
3361
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
3462
env:

0 commit comments

Comments
 (0)