Skip to content

Commit e5f3ff3

Browse files
authored
fix: consolidate Docker build into release workflow (#5)
* fix: consolidate Docker build into release workflow * fix: install diffutils in container for GNU diff color support
1 parent adc9e47 commit e5f3ff3

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
go-version: '1.25'
2222

2323
- name: Semantic Release
24+
id: semantic
2425
uses: cycjimmy/semantic-release-action@v4
2526
with:
2627
extra_plugins: |
@@ -29,34 +30,30 @@ jobs:
2930
env:
3031
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3132

32-
docker:
33-
runs-on: ubuntu-latest
34-
needs: release
35-
steps:
36-
- uses: actions/checkout@v4
37-
with:
38-
fetch-depth: 0
39-
4033
- name: Set up Docker Buildx
34+
if: steps.semantic.outputs.new_release_published == 'true'
4135
uses: docker/setup-buildx-action@v3
4236

4337
- name: Login to GHCR
38+
if: steps.semantic.outputs.new_release_published == 'true'
4439
uses: docker/login-action@v3
4540
with:
4641
registry: ghcr.io
4742
username: ${{ github.actor }}
4843
password: ${{ secrets.GITHUB_TOKEN }}
4944

5045
- name: Docker meta
46+
if: steps.semantic.outputs.new_release_published == 'true'
5147
id: meta
5248
uses: docker/metadata-action@v5
5349
with:
5450
images: ghcr.io/${{ github.repository }}
5551
tags: |
56-
type=semver,pattern={{version}}
52+
type=raw,value=${{ steps.semantic.outputs.new_release_version }}
5753
type=raw,value=latest
5854
5955
- name: Build and push
56+
if: steps.semantic.outputs.new_release_published == 'true'
6057
uses: docker/build-push-action@v6
6158
with:
6259
context: .

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o terraform-gitlab-drift
1010

1111
FROM alpine:3.23.3
1212

13-
RUN apk --no-cache add ca-certificates
13+
RUN apk --no-cache add ca-certificates diffutils
1414

1515
COPY --from=builder /build/terraform-gitlab-drift /usr/local/bin/terraform-gitlab-drift
1616

0 commit comments

Comments
 (0)