name: Container Image on: push: branches: - main tags: - v* workflow_dispatch: permissions: contents: read packages: write env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true concurrency: group: image-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: docker: name: Build container image runs-on: ubuntu-latest timeout-minutes: 45 steps: - name: Check out repository uses: actions/checkout@v7 - name: Prepare licensed assets run: node ./scripts/prepare-licensed-assets.cjs - name: Derive image name id: vars run: echo "image_name=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Extract image metadata id: meta uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 with: images: ${{ steps.vars.outputs.image_name }} tags: | type=ref,event=branch type=ref,event=tag type=sha,prefix=sha- type=raw,value=latest,enable={{is_default_branch}} - name: Log in to GitHub Container Registry if: github.event_name != 'pull_request' uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and optionally publish image uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a with: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max