Skip to content

Bump the actions group with 3 updates #12

Bump the actions group with 3 updates

Bump the actions group with 3 updates #12

name: OrcaHello.Web.Api
on:
pull_request:
branches:
- main
paths:
- ModeratorFrontEnd/OrcaHello/OrcaHello.Web.Api/**
- ModeratorFrontEnd/OrcaHello/OrcaHello.Web.Shared/**
- .github/workflows/OrcaHello.Web.Api.yaml
push:
branches:
- main
paths:
- ModeratorFrontEnd/OrcaHello/OrcaHello.Web.Api/**
- ModeratorFrontEnd/OrcaHello/OrcaHello.Web.Shared/**
- .github/workflows/OrcaHello.Web.Api.yaml
workflow_dispatch: # Allow manual workflow invocation from the Github Actions UI
env:
DOTNET_VERSION: 8.0.x
DOTNET_RUNTIME: win-x86
WORKING_DIR: ModeratorFrontEnd/OrcaHello/OrcaHello.Web.Api
PUBLISH_DIR: output
AZURE_APP_NAME: AIForOrcasDetections2
defaults:
run:
working-directory: ModeratorFrontEnd/OrcaHello/OrcaHello.Web.Api
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@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up .NET Core
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
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 }}
- 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@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
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@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- name: Artifacts cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ./${{ env.WORKING_DIR}}/${{ env.PUBLISH_DIR }}
key: ${{ github.sha }}-${{ env.AZURE_APP_NAME }}-${{ env.DOTNET_RUNTIME }}-artifacts
- name: Deploy to azure
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ env.AZURE_APP_NAME }}
publish-profile: ${{ secrets.AZURE_ORCAHELLODETECTIONS_PUBLISH_PROFILE }}
package: ./${{ env.WORKING_DIR }}/${{ env.PUBLISH_DIR }}