Skip to content

removing migrations bundles for now #11

removing migrations bundles for now

removing migrations bundles for now #11

# This workflow is used for any merge to main and results in a built container image being pushed and tagged as a dev release
# with commit hash and timestamp tags
#
# These are not stable or pre-release semver releases!
name: Publish a Relay Dev Release
on:
push:
branches: [main]
paths:
- app/Hutch.Relay/**
- .github/workflows/release.relay.dev.yml
env:
project: ./app/Hutch.Relay
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
jobs:
# Any initialisation other jobs depend on?
# e.g. getting the version number and putting in an output for easier use
init:
runs-on: ubuntu-latest
outputs:
source-version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
# get app version from csproj
- name: Read version
id: version
uses: bbonkr/get-version-action@v1
with:
project: ${{ env.project }}/Hutch.Relay.csproj
publish-binaries:
needs: [init]
runs-on: ubuntu-latest
env:
build-config: release
dotnet-version: 9.0.x
publish-dir: publish
strategy:
matrix:
include:
- artifact: win-x64
args: >-
-r win-x64
-p:PublishSingleFile=true
-p:IncludeNativeLibrariesInSingleFile=true
--self-contained
- artifact: linux-x64
args: >-
-r linux-x64
-p:PublishSingleFile=true
-p:IncludeNativeLibrariesInSingleFile=true
--self-contained
- artifact: dotnet
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.dotnet-version }}
- name: dotnet publish
run: >-
dotnet publish
${{ env.project }}
-c ${{ env.build-config }}
-o ${{ env.publish-dir }}
${{ matrix.args }}
- uses: actions/upload-artifact@v3
with:
name: hutch-relay-${{ needs.init.outputs.source-version }}_${{ matrix.artifact == 'dotnet' && format('{0}-{1}', matrix.artifact, env.dotnet-version) || matrix.artifact }}
path: ${{ env.publish-dir }}
# TODO: Publish platform native EF Core migrations bundles
# publish-migrations:
# needs: [init]
# runs-on: ubuntu-latest
# env:
# output-filename: migrate-relay-db
# strategy:
# matrix:
# include:
# - artifact: win-x64
# file-extension: ".exe"
# args: >-
# -r win-x64
# - artifact: linux-x64
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-dotnet@v4
# with:
# dotnet-version: ${{ env.dotnet-version }}
# - run: dotnet tool restore
# - run: >-
# dotnet ef migrations bundle
# -p ${{ env.project }}
# -s ${{ env.project }}
# -o ${{ format('{0}{1}', env.output-filename, matrix.file-extension) }}
# ${{ matrix.args }}
# --self-contained
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ format('migrations-{0}_{1}', needs.init.outputs.source-version, matrix.artifact) }}
# path: ${{ format('{0}{1}', env.output-filename, matrix.file-extension) }}
# Publish Edge Container Image to GHCR
publish-containers:
needs: [init]
runs-on: ubuntu-latest
permissions:
packages: write
env:
image-name: hutch/relay
repo-owner: ${{ github.repository_owner }}
registry: ghcr.io
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Docker Login
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Metadata action
id: meta
uses: docker/[email protected]
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
with:
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.image-name }}
# Tag notes:
# - RFC3339 is not suitable for docker tags, so we squash the date
# - We tag both the short (7-char prefixed) and full sha commit hashes; both are useful
# - `edge` represents latest main branch commit (potentially unstable)
tags: |
type=sha
${{ github.sha }}
type=raw,value={{date 'YYYYMMDDHHmmss[Z]'}}
edge
# Label notes:
# - Static labels are applied in the Dockerfile
# - Date format in `org.opencontainers.image.created` must be RFC3339
# - version should be considered a semver candidate only, unless revision aligns with a git tag
labels: |
org.opencontainers.image.revision={{sha}}
org.opencontainers.image.version=${{ needs.init.outputs.source-version }}
org.opencontainers.image.created={{date 'YYYY-MM-DD HH:mm:ss[Z]'}}
# TODO: More Annotations may be desirable instead of labels for some metadata,
# since we produce multiarch images
annotations: |
org.opencontainers.image.description=Hutch Relay
- name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: app/Hutch.Relay/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}