Skip to content

Logging (#82)

Logging (#82) #16

name: GithubActionsRelease
############################################################################################################
# All of thes jobs runs commands only on a tag push in the MarkStega\ICEBG repository
# An 'ExitWorkflow' action is sorely needed
############################################################################################################
# NUGET_API_KEY is valid through 9/11/2021
############################################################################################################
on:
push:
tags:
- '*' # Push events to matching *, i.e. 1.0, 20.15.10
env:
appNameDS: 'icebg.web.ds'
appNameUI: 'icebg.web.ui'
containerRegistry: 'cricebg.azurecr.io'
jobs:
############################################################################################################
# These jobs are used to gate actions. By creating these jobs we don't need to proliferate the repo checks
############################################################################################################
deployment-allowed:
name: Deployment allowed
runs-on: ubuntu-latest
if: github.repository == 'MarkStega/ICEBG'
steps:
- name: Nothing to see here
run: echo ""
deployment-not-allowed:
name: Deployment not allowed
runs-on: ubuntu-latest
if: github.repository != 'MarkStega/ICEBG'
steps:
- name: Nothing to see here
run: echo ""
build-allowed:
name: Build allowed
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- name: Nothing to see here
run: echo ""
############################################################################################################
# Set unified version for the two deployed applications
############################################################################################################
set-unified-version:
name: Create the date based unifiedVersion
needs: [deployment-allowed,build-allowed]
runs-on: ubuntu-latest
outputs:
unifiedVersion: ${{ steps.setUnifiedVersion.outputs.LocalUnifiedVersion }}
steps:
- id: setUnifiedVersion
run: echo "LocalUnifiedVersion=$(date +'%Y-%m-%d--%H-%M-%S')--${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
shell: bash
############################################################################################################
# Build and deploy blazor DS image
############################################################################################################
build-deploy-ds:
name: Build and deploy ICEBG DS
needs: [set-unified-version]
runs-on: ubuntu-latest
steps:
- name: Retrieve the global unifiedVersion
run: echo "unifiedVersion=${{needs.set-unified-version.outputs.unifiedVersion}}" >> $GITHUB_ENV
shell: bash
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: 'Docker login'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Publish tagged DS image
run: |
dotnet publish ICEBG.Web.DataServices/ICEBG.Web.DataServices.csproj --os linux --arch x64 --configuration Azure -p:PublishProfile=DefaultContainer -p:Version=${{ env.unifiedVersion }} -p:ContainerRegistry=${{env.containerRegistry}} -p:ContainerRepository=${{env.appNameUI}} -p:ContainerImageName=${{env.appNameDS}} -p:ContainerImageTag=${{ env.unifiedVersion }} --no-self-contained
############################################################################################################
# Build and deploy blazor UI image
############################################################################################################
build-deploy-ui:
name: Build and deploy ICEBG UI
needs: [set-unified-version]
runs-on: ubuntu-latest
steps:
- name: Retrieve the global unifiedVersion
run: echo "unifiedVersion=${{needs.set-unified-version.outputs.unifiedVersion}}" >> $GITHUB_ENV
shell: bash
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: 'Docker login'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Publish tagged UI image
run: |
dotnet publish ICEBG.Web.UserInterface/ICEBG.Web.UserInterface.csproj --os linux --arch x64 --configuration Azure -p:PublishProfile=DefaultContainer -p:Version=${{ env.unifiedVersion }} -p:ContainerRegistry=${{env.containerRegistry}} -p:ContainerRepository=${{env.appNameUI}} -p:ContainerImageName=${{env.appNameUI}} -p:ContainerImageTag=${{ env.unifiedVersion }} --self-contained
############################################################################################################
# Build blazor DS image
############################################################################################################
build-ds:
name: Build ICEBG DS
needs: [deployment-not-allowed, build-allowed]
runs-on: windows-latest
steps:
- name: Set unifiedVersion as env variable
run: echo "unifiedVersion=$(date +'%Y-%m-%d--%H-%M-%S')--${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
shell: bash
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: Build DS image
run: |
dotnet build ICEBG.Web.DataServices/ICEBG.Web.DataServices.csproj --os linux --arch x64 --configuration Azure -p:Version=${{ env.unifiedVersion }}
############################################################################################################
# Build blazor UI image
############################################################################################################
build-ui:
name: Build ICEBG UI
needs: [deployment-not-allowed, build-allowed]
runs-on: windows-latest
steps:
- name: Set unifiedVersion as env variable
run: echo "unifiedVersion=$(date +'%Y-%m-%d--%H-%M-%S')--${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
shell: bash
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: Build UI image
run: |
dotnet build ICEBG.Web.UserInterface/ICEBG.Web.UserInterface.csproj --os linux --arch x64 --configuration Azure -p:Version=${{ env.unifiedVersion }}