Fixed broken query #153
This file contains hidden or 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: Docker Image CI | |
on: | |
push: | |
branches: [ main, develop ] | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Tag Version | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: DockerHub Login | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set Version Variables | |
run: | | |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
else | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
echo "VERSION=${BRANCH_NAME}" >> $GITHUB_ENV | |
fi | |
echo "GIT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Docker Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm,arm64,amd64 | |
- name: Docker Setup Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build & Push Docker image (Latest) | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/') | |
run: | | |
docker buildx build . \ | |
--file Dockerfile \ | |
--build-arg VERSION=${{ env.VERSION }} \ | |
--build-arg GIT_COMMIT=${{ env.GIT_COMMIT }} \ | |
--cache-from=type=registry,ref=kcapp/api:cache \ | |
--cache-to=type=registry,ref=kcapp/api:cache,mode=max \ | |
--build-arg force_migrations_update=$(date +%s) \ | |
-t kcapp/api:latest \ | |
--platform=linux/arm,linux/arm64,linux/amd64 \ | |
--push | |
- name: Build & Push Docker image (Release version) | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
run: | | |
docker buildx build . \ | |
--file Dockerfile \ | |
--build-arg VERSION=${{ env.VERSION }} \ | |
--build-arg GIT_COMMIT=${{ env.GIT_COMMIT }} \ | |
--cache-from=type=registry,ref=kcapp/api:cache \ | |
--cache-to=type=registry,ref=kcapp/api:cache,mode=max \ | |
-t kcapp/api:${{ env.RELEASE_VERSION }} \ | |
--platform=linux/arm,linux/arm64,linux/amd64 \ | |
--push |