Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions .github/workflows/container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,27 +115,54 @@ jobs:
if: "${{ env.DOCKER_HUB_ACCESS_TOKEN != '' }}"
run: echo "continue=true" >> $GITHUB_OUTPUT

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

steps:
- id: meta_development
if: needs.context.outputs.type == 'development'
name: Docker Meta (development)
- id: meta
name: Docker Meta
uses: docker/metadata-action@v4
with:
images: |
"${{ secrets.DOCKER_HUB_USERNAME }}/${{secrets.DOCKER_HUB_REPOSITORY_NAME }}"
tags: |
type=ref,event=branch

- id: meta_release
if: needs.context.outputs.type == 'release'
name: Docker Meta (release)
- id: login
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- id: setup
name: Setup Toolchain
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v4
with:
file: ./Containerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha

publish_release:
name: Publish (Release)
environment: dockerhub-torrust
needs: [secrets, context]
if: needs.secrets.outputs.continue == 'true' && needs.context.outputs.type == 'release'
runs-on: ubuntu-latest

steps:
- id: meta
name: Docker Meta
uses: docker/metadata-action@v4
with:
images: |
Expand Down