Skip to content

Added Union.cs as an embedded resource. Fixes #138 #44

Added Union.cs as an embedded resource. Fixes #138

Added Union.cs as an embedded resource. Fixes #138 #44

Workflow file for this run

name: Docker ModelCompiler CI
on:
push:
branches: [ master, docker* ]
tags: [ '*' ]
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DOCKERSIGN: false
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up .NET 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.x'
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request' && env.DOCKERSIGN == 'true'
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v1.13.1'
# https://github.com/docker/build-push-action
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
# 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@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_UPLOAD }}
- name: Prepare Tag Repo Info
run: |
echo IMAGE_REPOSITORY=${{ env.REGISTRY }}/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]' | awk '{gsub(/|\./, "")}1') >> $GITHUB_ENV
echo IMAGE_VERSION= >> $GITHUB_ENV
- name: Set image version from tag
if: github.ref_type == 'tag'
run: |
echo IMAGE_VERSION=$(echo ${{ github.ref_name }}) >> $GITHUB_ENV
- name: Prepare Tag Branch info
if: github.ref_name != 'master' && github.ref_type == 'branch'
run: |
echo IMAGE_BRANCH=-$(echo ${{ github.ref }} | tr '[:upper:]' '[:lower:]' | awk '{sub(/([^\/]*\/){2}/,""); gsub(/\/|_/, "-")}1') >> $GITHUB_ENV
- name: Prepare version and latest tag
run: |
echo TAG_BRANCH=$(echo ${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_VERSION }}${{ env.IMAGE_BRANCH }}) >> $GITHUB_ENV
echo TAG_LATEST=$(echo ,${{ env.IMAGE_REPOSITORY }}:latest${{ env.IMAGE_BRANCH }}) >> $GITHUB_ENV
- name: Only use preview tag if no github tag info
if: github.ref_type == 'branch'
run: |
echo TAG_BRANCH= >> $GITHUB_ENV
echo TAG_LATEST=$(echo ${{ env.IMAGE_REPOSITORY }}:preview${{ env.IMAGE_BRANCH }}) >> $GITHUB_ENV
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# 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@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.TAG_BRANCH }} ${{ env.TAG_LATEST }}
platforms: linux/amd64
file: ./Dockerfile
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Sign the resulting Docker image digest except on PRs.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: github.event_name != 'pull_request' && env.DOCKERSIGN == 'true'
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: |
echo Signing ${{ env.IMAGE_REPOSITORY }}@${{ steps.build-and-push.outputs.digest }}
echo "${{ env.IMAGE_REPOSITORY }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}