try to fix docs deploy v4 #149
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: Build and Push Docker image | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
- dev | |
env: | |
REGISTRY: docker.io | |
IMAGE_NAME: ${{ secrets.DOCKER_USERNAME && secrets.DOCKER_USERNAME || 'dependabot' }}/nevron | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: ${{ !contains(github.ref, 'main')}} | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
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: Extract metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
# Tag with 'latest' for main branch | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
# Tag with branch name | |
type=ref,event=branch | |
# Tag with version when a version tag is pushed | |
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
# Tag with 'stable' for version tags | |
type=raw,value=stable,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
# Tag with short SHA for all pushes | |
type=sha,format=short | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
if: github.actor != 'dependabot[bot]' && github.event_name == 'push' | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: ${{ github.event_name == 'push' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 |