name: Docker Image CI on: push: tags: - '*' # Trigger on any tag branches: - main # Trigger on push to main branch - beta # Trigger on push to beta branch paths-ignore: - '**.md' permissions: packages: write jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Docker Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/chocomeow/vocard tags: | # For version tags (v1.2.3) type=ref,event=tag # For main branch type=raw,value=latest,enable={{is_default_branch}} # For beta branch type=raw,value=beta,enable=${{ github.ref == 'refs/heads/beta' }} flavor: | latest=false - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max