Skip to content

Publish Docker image #6

Publish Docker image

Publish Docker image #6

name: Publish Docker image
on:
workflow_run:
workflows: ["continuous integration"]
branches:
- main
- master
types:
- completed
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
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 Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
- name: Run docker tag sh and export var form config.yml
run: |
./docker_tag.sh
- uses: cardinalby/export-env-action@v2
with:
envFile: '.env'
# - name: Import environment variables from a file
# shell: bash
# run: |
# while read line; do
# echo "$line" >> $GITHUB_ENV
# done < ${{ env.ENV_FILE }}
- name: Debug
run: |
echo ${env.DOCKER_REPO_NAME}
echo "${{ env.NEW_TAG }}"
echo $env.DOCKER_HUB_USERNAME
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_REPO_NAME }}:${{ env.NEW_TAG }}