Skip to content

Commit 33893a3

Browse files
feat(docker)!: adjust artifact and release logic
1 parent b851769 commit 33893a3

3 files changed

Lines changed: 30 additions & 111 deletions

File tree

.github/workflows/__call-docker.yml

Lines changed: 29 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ on:
2727
- synchronize
2828
- reopened
2929
workflow_call:
30+
inputs:
31+
maximize_build_space:
32+
description: 'Maximize build space.'
33+
required: false
34+
type: boolean
35+
default: false
36+
publish_release:
37+
required: true
38+
type: string
39+
release_commit:
40+
required: true
41+
type: string
42+
release_tag:
43+
required: true
44+
type: string
3045
secrets:
3146
DOCKER_HUB_USERNAME:
3247
description: 'Docker Hub username to use for the workflow.'
@@ -89,68 +104,25 @@ jobs:
89104
echo $matrix | jq .
90105
echo "matrix=$matrix" >> $GITHUB_OUTPUT
91106
92-
- name: Find dotnet solution file
93-
id: find_dotnet
94-
run: |
95-
solution=$(find . -maxdepth 1 -type f -iname "*.sln")
96-
97-
echo "found solution: ${solution}"
98-
99-
# do not quote to keep this as a single line
100-
echo solution=${solution} >> $GITHUB_OUTPUT
101-
102-
if [[ $solution != "" ]]; then
103-
echo "dotnet=true" >> $GITHUB_OUTPUT
104-
else
105-
echo "dotnet=false" >> $GITHUB_OUTPUT
106-
fi
107-
108107
outputs:
109108
dockerfiles: ${{ steps.find.outputs.dockerfiles }}
110109
matrix: ${{ steps.find.outputs.matrix }}
111-
dotnet: ${{ steps.find_dotnet.outputs.dotnet }}
112-
solution: ${{ steps.find_dotnet.outputs.solution }}
113-
114-
setup_release:
115-
name: Setup Release
116-
if: needs.check_dockerfiles.outputs.dockerfiles
117-
needs: check_dockerfiles
118-
outputs:
119-
publish_release: ${{ steps.setup_release.outputs.publish_release }}
120-
release_body: ${{ steps.setup_release.outputs.release_body }}
121-
release_commit: ${{ steps.setup_release.outputs.release_commit }}
122-
release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }}
123-
release_tag: ${{ steps.setup_release.outputs.release_tag }}
124-
release_version: ${{ steps.setup_release.outputs.release_version }}
125-
permissions:
126-
contents: write # read does not work to check squash and merge details
127-
runs-on: ubuntu-latest
128-
steps:
129-
- name: Checkout
130-
uses: actions/checkout@v4
131-
132-
- name: Setup Release
133-
id: setup_release
134-
uses: LizardByte/setup-release-action@v2025.612.120948
135-
with:
136-
dotnet: ${{ needs.check_dockerfiles.outputs.dotnet }}
137-
github_token: ${{ secrets.GH_TOKEN }}
138110

139111
docker:
140112
name: Docker${{ matrix.tag }}
141113
if: needs.check_dockerfiles.outputs.dockerfiles
142114
needs:
143115
- check_dockerfiles
144-
- setup_release
145116
permissions:
117+
contents: read
146118
packages: write
147-
contents: write
148119
runs-on: ubuntu-22.04
149120
strategy:
150121
fail-fast: false
151122
matrix: ${{ fromJson(needs.check_dockerfiles.outputs.matrix) }}
152123
steps:
153124
- name: Maximize build space
125+
if: inputs.maximize_build_space
154126
uses: easimon/maximize-build-space@v10
155127
with:
156128
root-reserve-mb: 30720 # https://github.com/easimon/maximize-build-space#caveats
@@ -168,13 +140,13 @@ jobs:
168140
- name: Prepare
169141
id: prepare
170142
env:
171-
NV: ${{ needs.setup_release.outputs.release_tag }}
143+
NV: ${{ inputs.release_tag }}
172144
run: |
173145
# get branch name
174146
BRANCH=${GITHUB_HEAD_REF}
175147
176-
RELEASE=${{ needs.setup_release.outputs.publish_release }}
177-
COMMIT=${{ needs.setup_release.outputs.release_commit }}
148+
RELEASE=${{ inputs.publish_release }}
149+
COMMIT=${{ inputs.release_commit }}
178150
179151
if [ -z "$BRANCH" ]; then
180152
echo "This is a PUSH event"
@@ -273,14 +245,14 @@ jobs:
273245
Docker-buildx${{ matrix.tag }}-
274246
275247
- name: Log in to Docker Hub
276-
if: needs.setup_release.outputs.publish_release == 'true' # PRs do not have access to secrets
248+
if: inputs.publish_release == 'true' # PRs do not have access to secrets
277249
uses: docker/login-action@v3
278250
with:
279251
username: ${{ secrets.DOCKER_HUB_USERNAME }}
280252
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
281253

282254
- name: Log in to the Container registry
283-
if: needs.setup_release.outputs.publish_release == 'true' # PRs do not have access to secrets
255+
if: inputs.publish_release == 'true' # PRs do not have access to secrets
284256
uses: docker/login-action@v3
285257
with:
286258
registry: ghcr.io
@@ -301,10 +273,10 @@ jobs:
301273
build-args: |
302274
BRANCH=${{ steps.prepare.outputs.branch }}
303275
BUILD_DATE=${{ steps.prepare.outputs.build_date }}
304-
BUILD_VERSION=${{ needs.setup_release.outputs.release_tag }}
305-
COMMIT=${{ needs.setup_release.outputs.release_commit }}
276+
BUILD_VERSION=${{ inputs.release_tag }}
277+
COMMIT=${{ inputs.release_commit }}
306278
CLONE_URL=${{ steps.prepare.outputs.clone_url }}
307-
RELEASE=${{ needs.setup_release.outputs.publish_release }}
279+
RELEASE=${{ inputs.publish_release }}
308280
tags: ${{ steps.prepare.outputs.tags }}
309281
cache-from: type=local,src=/tmp/.buildx-cache
310282
cache-to: type=local,dest=/tmp/.buildx-cache
@@ -316,15 +288,15 @@ jobs:
316288
with:
317289
context: ./
318290
file: ${{ matrix.dockerfile }}
319-
push: ${{ needs.setup_release.outputs.publish_release }}
291+
push: ${{ inputs.publish_release }}
320292
platforms: ${{ steps.prepare.outputs.platforms }}
321293
build-args: |
322294
BRANCH=${{ steps.prepare.outputs.branch }}
323295
BUILD_DATE=${{ steps.prepare.outputs.build_date }}
324-
BUILD_VERSION=${{ needs.setup_release.outputs.release_tag }}
325-
COMMIT=${{ needs.setup_release.outputs.release_commit }}
296+
BUILD_VERSION=${{ inputs.release_tag }}
297+
COMMIT=${{ inputs.release_commit }}
326298
CLONE_URL=${{ steps.prepare.outputs.clone_url }}
327-
RELEASE=${{ needs.setup_release.outputs.publish_release }}
299+
RELEASE=${{ inputs.publish_release }}
328300
tags: ${{ steps.prepare.outputs.tags }}
329301
cache-from: type=local,src=/tmp/.buildx-cache
330302
cache-to: type=local,dest=/tmp/.buildx-cache
@@ -360,21 +332,6 @@ jobs:
360332
path: artifacts/
361333
if-no-files-found: error
362334

363-
- name: Create/Update GitHub Release
364-
if: >
365-
needs.setup_release.outputs.publish_release == 'true' &&
366-
steps.prepare.outputs.artifacts == 'true'
367-
uses: LizardByte/create-release-action@v2025.612.13419
368-
with:
369-
allowUpdates: true
370-
artifacts: "*artifacts/*"
371-
body: ${{ needs.setup_release.outputs.release_body }}
372-
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
373-
name: ${{ needs.setup_release.outputs.release_tag }}
374-
prerelease: true
375-
tag: ${{ needs.setup_release.outputs.release_tag }}
376-
token: ${{ secrets.GH_BOT_TOKEN }}
377-
378335
- name: Update Docker Hub Description
379336
if: >
380337
github.event_name == 'push' &&

.github/workflows/__global-replicator.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
.codeql-prebuild-cpp-macOS.sh,
5252
.github/label-actions.yml,
5353
.github/pr_release_template.md,
54+
.github/workflows/_docker.yml,
5455
.github/workflows/auto-create-pr.yml,
5556
.github/workflows/automerge.yml,
5657
.github/workflows/autoupdate.yml,

.github/workflows/_docker.yml

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

0 commit comments

Comments
 (0)