From 4e46873fd6714cd2ffbdf16ca8cc5aa9e79724d3 Mon Sep 17 00:00:00 2001 From: Drew Rautenberg <8411007+DrewRautenberg@users.noreply.github.com> Date: Sun, 12 Jan 2025 18:58:34 -0600 Subject: [PATCH 1/2] Update docker-image.yml --- .github/workflows/docker-image.yml | 80 +++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 3f53646..c95d0e4 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,18 +1,86 @@ -name: Docker Image CI +name: Publish Docker Image on: push: branches: [ "main" ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] pull_request: branches: [ "main" ] +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + + jobs: - build: - runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write steps: - - uses: actions/checkout@v4 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0 + with: + cosign-release: 'v2.2.4' + + # Set up BuildKit Docker container builder to be able to build + # multi-platform images and export cache + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + # Login against a Docker registry except on PR + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=sha,format=long + + # Build and push Docker image with Buildx (don't push on PR) + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + with: + context: ./barkmanAPI + 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 + + # Sign the resulting Docker image digest except on PRs. + # This will only write to the public Rekor transparency log when the Docker + # repository is public to avoid leaking data. If you would like to publish + # transparency data even for private images, pass --force to cosign below. + - name: Sign the published Docker image + if: ${{ github.event_name != 'pull_request' }} + env: + # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + # This step uses the identity token to provision an ephemeral certificate + # against the sigstore community Fulcio instance. + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} From 2a656dbb879690bb04ccd7f51e3ebd5ede46d35d Mon Sep 17 00:00:00 2001 From: Drew Rautenberg <8411007+DrewRautenberg@users.noreply.github.com> Date: Sun, 12 Jan 2025 19:05:56 -0600 Subject: [PATCH 2/2] Rename barkmanAPI.csproj to barkmanapi.csproj --- barkmanAPI/{barkmanAPI.csproj => barkmanapi.csproj} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename barkmanAPI/{barkmanAPI.csproj => barkmanapi.csproj} (100%) diff --git a/barkmanAPI/barkmanAPI.csproj b/barkmanAPI/barkmanapi.csproj similarity index 100% rename from barkmanAPI/barkmanAPI.csproj rename to barkmanAPI/barkmanapi.csproj