Skip to content

Workflow file for this run

name: Create release and asset
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the develop branch
release:
types:
- published
env:
# Pretty cargo output!
CARGO_TERM_COLOR: always
jobs:
check-docker-secrets:
name: Check if docker hub registry information was set on secrets
runs-on: ubuntu-latest
outputs:
is_have_secrets: ${{ steps.check_secret_job.outputs.is_have_secrets }}
steps:
- id: check_secret_job
run: |
if [[ "${{ secrets.DOCKER_HUB_REPO_NAME }}" != "" && \
"${{ secrets.DOCKER_USERNAME }}" != "" && \
"${{ secrets.DOCKER_TOKEN }}" != "" ]]; \
then
echo "Secrets to use a container registry are configured in the repo"
echo "is_have_secrets=true" >> $GITHUB_OUTPUT
else
echo "Secrets to use a container registry were not configured in the repo"
echo "is_have_secrets=false" >> $GITHUB_OUTPUT
fi
# TODO: Download .tar and add docker image without uncompress
# Publish docker multiarch image in Docker Hub Registry to application
push-imame-dhr:
name: Push docker multiarch image to Docker Hub
needs:
- check-docker-secrets
# Skip step based on secret
if: needs.check-docker-secrets.outputs.is_have_secrets == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push image in Docker Hub
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/amd64/v2,linux/arm64/v8
push: true
build-args: |
BUILD_VERSION=${{ github.event.release.tag_name }}
tags: |
${{ secrets.DOCKER_HUB_REPO_NAME }}:${{ github.event.release.tag_name }}
${{ secrets.DOCKER_HUB_REPO_NAME }}