Skip to content

Commit 37fd055

Browse files
committed
Merge #420: dev: more container workflow fixups
835b499 dev: more container workflow fixups (Cameron Garnham) Pull request description: ACKs for top commit: da2ce7: ACK 835b499 Tree-SHA512: c3c442ffc34814c87df11a39b6b06d9ec3ad111571cdbbdc56246b9bfd0dabe5771ac485af1cccb04ae0cfde1a6861db8ddc717b1c01813fcacb4dcd960650ff
2 parents 0b70da1 + 835b499 commit 37fd055

1 file changed

Lines changed: 36 additions & 9 deletions

File tree

.github/workflows/container.yaml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,27 +115,54 @@ jobs:
115115
if: "${{ env.DOCKER_HUB_ACCESS_TOKEN != '' }}"
116116
run: echo "continue=true" >> $GITHUB_OUTPUT
117117

118-
publish:
119-
name: Publish
118+
publish_development:
119+
name: Publish (Development)
120120
environment: dockerhub-torrust
121121
needs: [secrets, context]
122-
if: needs.secrets.outputs.continue == 'true'
122+
if: needs.secrets.outputs.continue == 'true' && needs.context.outputs.type == 'development'
123123
runs-on: ubuntu-latest
124124

125125
steps:
126-
- id: meta_development
127-
if: needs.context.outputs.type == 'development'
128-
name: Docker Meta (development)
126+
- id: meta
127+
name: Docker Meta
129128
uses: docker/metadata-action@v4
130129
with:
131130
images: |
132131
"${{ secrets.DOCKER_HUB_USERNAME }}/${{secrets.DOCKER_HUB_REPOSITORY_NAME }}"
133132
tags: |
134133
type=ref,event=branch
135134
136-
- id: meta_release
137-
if: needs.context.outputs.type == 'release'
138-
name: Docker Meta (release)
135+
- id: login
136+
name: Login to Docker Hub
137+
uses: docker/login-action@v2
138+
with:
139+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
140+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
141+
142+
- id: setup
143+
name: Setup Toolchain
144+
uses: docker/setup-buildx-action@v2
145+
146+
- name: Build and push
147+
uses: docker/build-push-action@v4
148+
with:
149+
file: ./Containerfile
150+
push: true
151+
tags: ${{ steps.meta.outputs.tags }}
152+
labels: ${{ steps.meta.outputs.labels }}
153+
cache-from: type=gha
154+
cache-to: type=gha
155+
156+
publish_release:
157+
name: Publish (Release)
158+
environment: dockerhub-torrust
159+
needs: [secrets, context]
160+
if: needs.secrets.outputs.continue == 'true' && needs.context.outputs.type == 'release'
161+
runs-on: ubuntu-latest
162+
163+
steps:
164+
- id: meta
165+
name: Docker Meta
139166
uses: docker/metadata-action@v4
140167
with:
141168
images: |

0 commit comments

Comments
 (0)