CD | Build-Release #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | Build-Release | |
on: | |
push: | |
branches: | |
- "main" | |
paths-ignore: | |
- "README.md" | |
- "**/*.md" | |
- "docs/**" | |
- "**/*.yml" | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
image_tag: | |
description: "Docker Image Tag" | |
required: false | |
default: "dev" | |
jobs: | |
docker-build: | |
runs-on: self-hosted | |
steps: | |
- name: Free disk space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
sudo apt-get clean | |
df -h # Check available space | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Build and push step | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
build-args: | | |
HUGGINGFACE_TOKEN=${{ secrets.HUGGINGFACE_TOKEN }} | |
tags: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && github.event.inputs.image_tag) || 'dev' }} | |