Skip to content

NotificationSystem

NotificationSystem #27

name: NotificationSystem
on:
pull_request:
branches:
- main
paths:
- NotificationSystem/**
push:
branches:
- main
paths:
- NotificationSystem/**
workflow_dispatch: # Allow manual workflow invocation from the Github Actions UI
env:
DOTNET_VERSION: 6.0.x
DOTNET_RUNTIME: win-x86
WORKING_DIR: NotificationSystem
PUBLISH_DIR: output
AZURE_APP_NAME: orcanotification
defaults:
run:
working-directory: NotificationSystem
permissions: # added using https://github.com/step-security/secure-repo
contents: read
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup .NET Core
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Dependencies
run: dotnet restore -r ${{ env.DOTNET_RUNTIME }}
- name: Build
run: dotnet build --no-restore -c Release -r ${{ env.DOTNET_RUNTIME }} --self-contained
# - name: Test
# run: dotnet test --no-restore -r ${{ env.DOTNET_RUNTIME }}
- name: Publish
run: dotnet publish --no-restore -c Release -o './${{ env.PUBLISH_DIR }}'
- name: Artifacts cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: ./${{ env.WORKING_DIR }}/${{ env.PUBLISH_DIR }}
key: ${{ github.sha }}-${{ env.AZURE_APP_NAME }}-${{ env.DOTNET_RUNTIME }}-artifacts
deploy:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: read
steps:
- uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit
- name: Artifacts cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: ./${{ env.WORKING_DIR}}/${{ env.PUBLISH_DIR }}
key: ${{ github.sha }}-${{ env.AZURE_APP_NAME }}-${{ env.DOTNET_RUNTIME }}-artifacts
- name: Deploy to Azure Functions
uses: azure/functions-action@fd80521afbba9a2a76a99ba1acc07aff8d733d11 # v1.5.2
with:
app-name: ${{ env.AZURE_APP_NAME }}
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
package: ./${{ env.WORKING_DIR }}/${{ env.PUBLISH_DIR }}