Skip to content

fugle-go-client-generator #37

fugle-go-client-generator

fugle-go-client-generator #37

Workflow file for this run

name: Docker Image CI
on:
push:
branches:
- "main"
tags:
- "*" # Trigger on all tags
jobs:
build:
runs-on: ubuntu-latest
steps:
- 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
with:
install: true
driver: docker-container # Use the docker-container driver
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Determine Docker image tag
id: docker_tag
run: |
if [ "${{ github.event_name }}" == "push" ] && [ -n "${{ github.sha }}" ]; then
echo "Image tag will be based on commit hash."
echo "::set-output name=tag::$(echo ${{ github.sha }} | cut -c1-6)"
elif [ "${{ github.event_name }}" == "push" ] && [ -n "${{ github.ref }}" ]; then
echo "Image tag will be based on Git tag."
echo "::set-output name=tag::${{ github.ref_name }}"
else
echo "Unable to determine tag."
exit 1
fi
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: yitech/fugle-fastapi:${{ steps.docker_tag.outputs.tag }}
platforms: linux/amd64