Skip to content

Testing Workflow

Testing Workflow #5

name: Build docker container and push to dockerhub
on:
release:
types: [published]
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Release Version Tag (0.0.0)'
required: true
jobs:
build:
runs-on: ubuntu-latest
name: 'Build container and push'
permissions:
packages: write
contents: read
steps:
- name: Checkout code
uses: actions/[email protected]
with:
ref: ${{ github.ref }}
- name: Update Package to Release Version
uses: technote-space/[email protected]
- name: Check Docker secret presence
id: checkdocker
shell: bash
run: |
if [ "$SECRET" == "" ] || [ "$USERNAME" == "" ]; then
echo "secretspresent=false" >> $GITHUB_OUTPUT
else
echo "secretspresent=true" >> $GITHUB_OUTPUT
fi
env:
SECRET: ${{ secrets.DOCKERHUB_TOKEN }}
USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
- name: Set up Docker Buildx
if: ${{ steps.checkdocker.outputs.secretspresent }}
uses: docker/[email protected]
- name: Login to DockerHub
if: ${{ steps.checkdocker.outputs.secretspresent == 'true' }}
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to Docker Hub
if: ${{ steps.checkdocker.outputs.secretspresent }}
uses: docker/build-push-action@v6
with:
context: "."
push: true
tags: |
qxip/expsuehep:latest
qxip/expsuehep:${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}