Skip to content

Merge pull request #4 from wiremind/feat/add-dry-run-and-fix-notion-b… #9

Merge pull request #4 from wiremind/feat/add-dry-run-and-fix-notion-b…

Merge pull request #4 from wiremind/feat/add-dry-run-and-fix-notion-b… #9

Workflow file for this run

name: Build and Publish Container Image
on:
push:
branches: [ main ]
tags: [ 'v*' ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
ci:
uses: ./.github/workflows/ci.yml
build-and-push:
needs: ci
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for semantic versioning
- name: Generate semantic version
id: version
uses: paulhatch/[email protected]
with:
bump_each_commit: true
- name: Display generated version
run: 'echo "Generated version: ${{ steps.version.outputs.version }}"'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ steps.version.outputs.version }},enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: .
file: ./Containerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max