Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish Docker image

on:
push:
workflow_dispatch:
pull_request:

jobs:
push_to_registry:
name: build and push image to ghcr
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
# - name: Check out the repo
# uses: actions/checkout@v4

- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Log in to Docker Hub
# uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
# with:
# images: my-docker-hub-namespace/my-docker-hub-repository

- name: Build and push container image
id: push
uses: docker/build-push-action@6.17.0
with:
context: "{{defaultContext}}:docker-image"
#file: Dockerfile

push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/${{ github.repository }}:${{ github.ref_name == github.event.repository.default_branch && 'latest' || github.ref_name }}
# tags: ${{ steps.meta.outputs.tags }}
#labels: ${{ steps.meta.outputs.labels }}

# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v2
# with:
# subject-name: index.docker.io/my-docker-hub-namespace/my-docker-hub-repository
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true
Loading