Skip to content

Release-Dockerhub

Release-Dockerhub #4

# This is a basic workflow to help you get started with Actions
name: Release-Dockerhub
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
workflow_run:
workflows: ["Build"]
types:
- completed
on:
branches:
- develop
- main
pull_requests:
- merged
env:
IMAGE_NAME: dingo-ubuntu
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
release:
# The type of runner that the job will run on
if: github.event.pull_request.merged == false
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build.yml
name: dingo.zip
- name: rename artifactory name
run: |
cp dingo.zip ./docker
# setup Docker buld action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Packages
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build image and push to Docker Hub and GitHub Container Registry
uses: docker/build-push-action@v6
with:
# relative path to the place where source code with Dockerfile is located
context: ./docker
# Note: tags has to be all lower-case
tags: dingodatabase/dingo:latest
# build on feature branches, push only on develop branch
push: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}