Skip to content

Commit

Permalink
Merge #420: dev: more container workflow fixups
Browse files Browse the repository at this point in the history
835b499 dev: more container workflow fixups (Cameron Garnham)

Pull request description:

ACKs for top commit:
  da2ce7:
    ACK 835b499

Tree-SHA512: c3c442ffc34814c87df11a39b6b06d9ec3ad111571cdbbdc56246b9bfd0dabe5771ac485af1cccb04ae0cfde1a6861db8ddc717b1c01813fcacb4dcd960650ff
  • Loading branch information
da2ce7 committed Sep 12, 2023
2 parents 0b70da1 + 835b499 commit 37fd055
Showing 1 changed file with 36 additions and 9 deletions.
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

0 comments on commit 37fd055

Please sign in to comment.