Skip to content

Bump github/codeql-action from 3.25.3 to 3.25.5 (#308) #931

Bump github/codeql-action from 3.25.3 to 3.25.5 (#308)

Bump github/codeql-action from 3.25.3 to 3.25.5 (#308) #931

name: Docker Publish
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
branches: [ "development", "main", "release", "nam20485" ]
#pull_request:
# branches: [ "development", "main", "release", "nam20485" ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
#VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
permissions:
contents: read
jobs:
build:
name: Docker-Build-and-Publish
runs-on: ubuntu-latest
permissions:
# write required for sending repository dispatch event
contents: write
# write required for uploading docker image to packages
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
# add problem matchers
- name: Add Problem Matchers
uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 # master
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: cosign-installer
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create CURRENT_DATETIME Environment Variable
run: |
echo "CURRENT_DATETIME=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
- name: Echo CURRENT_DATETIME Environment Variable
env:
CURRENT_DATETIME: ${{ env.CURRENT_DATETIME }}
run: echo ${{ env.CURRENT_DATETIME }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
CURRENT_DATETIME: ${{ env.CURRENT_DATETIME }}
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=pr
type=ref,event=branch,suffix=-${{github.run_number}}
type=ref,event=branch,suffix=-latest
annotations: |
org.opencontainers.image.source=https://github.com/nam20485/OdbDesign
org.opencontainers.image.description=A free open source cross-platform C++ library for parsing ODB++ Design archives and accessing their data. Exposed via a REST API and packaged inside of a Docker image. The OdbDesign Docker image runs the OdbDesign Server REST API server executable listening on port 8888.
org.opencontainers.image.licenses=MIT
org.opencontainers.image.authors=https://github.com/nam20485
org.opencontainers.image.url=https://nam20485.github.io/OdbDesign
org.opencontainers.image.documentation=https://github.com/nam20485/OdbDesign?tab=readme-ov-file
org.opencontainers.image.version=${{ github.ref_name }}-${{github.run_number}}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ env.CURRENT_DATETIME }}
org.opencontainers.image.title=OdbDesign Server
labels: |
org.opencontainers.image.version=${{ github.ref_name }}-${{github.run_number}}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ env.CURRENT_DATETIME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
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
file: Dockerfile
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
OWNER=nam20485
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
VCPKG_BINARY_SOURCES=clear;nuget,GitHub,readwrite
# ODBDESIGN_SERVER_REQUEST_USERNAME=${{ secrets.ODBDESIGN_SERVER_REQUEST_USERNAME }}
# ODBDESIGN_SERVER_REQUEST_PASSWORD=${{ secrets.ODBDESIGN_SERVER_REQUEST_PASSWORD }}
# 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.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes {}@${{ steps.build-and-push.outputs.digest }}
- name: Trigger Deploy and Release Workflows
if: github.ref_name == 'release' && github.event_name == 'push'
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
with:
repository: ${{ github.repository }}
event-type: trigger_deploy_release_event
client-payload: '{ "ref_name": "${{ github.ref_name }}", "run_number": "${{ github.run_number }}", "dispatch_id": "${{ secrets.DISPATCH_ID }}" }'