Merge branch 'main' of https://github.com/PzYon/engraved into scrap-t… #1652
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Api | |
on: | |
push: | |
paths: | |
- "api/**" | |
- "tests/**" | |
- ".github/workflows/api.yml" | |
- ".github/workflows/e2e-tests.yml" | |
workflow_dispatch: | |
inputs: | |
deploy: | |
description: "Force deployment" | |
required: false | |
default: "false" | |
jobs: | |
build: | |
name: Build API | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "8.x.x" | |
- name: Start MongoDB (for tests) | |
run: sudo systemctl start mongod | |
- name: Run tests | |
run: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover | |
working-directory: api | |
- name: Get current time | |
uses: josStorer/get-current-time@v2 | |
id: current-time | |
- name: Publish | |
run: dotnet publish ./Engraved.Api/Engraved.Api.csproj -c Release -o "${{env.DOTNET_ROOT}}/Engraved.Api" -p:SourceRevisionId=${{github.run_number}}+${{github.sha}}+${{steps.current-time.outputs.time}} | |
working-directory: api | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: api | |
path: ${{env.DOTNET_ROOT}}/Engraved.Api | |
e2e-tests: | |
name: "E2E Tests" | |
uses: ./.github/workflows/e2e-tests.yml | |
deploy-windows: | |
name: Deploy API (Windows) | |
runs-on: ubuntu-latest | |
needs: [build, e2e-tests] | |
if: github.ref == 'refs/heads/main' || github.event.inputs.deploy == 'true' | |
environment: | |
name: "Production" | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: api | |
- name: Deploy to Azure App Service (Windows) | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: "engraved" | |
slot-name: "Production" | |
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_CF17B8AFBCD14051B9CD5C069F5E294E }} | |
package: . | |
deploy-linux: | |
name: Deploy API (Linux) | |
runs-on: ubuntu-latest | |
needs: [build, e2e-tests] | |
if: github.ref == 'refs/heads/main' || github.event.inputs.deploy == 'true' | |
environment: | |
name: "Production" | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: api | |
- name: Deploy to Azure App Service (Linux) | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: "engraved-lnx" | |
slot-name: "Production" | |
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_CF17B8AFBCD14051B9CD5C069F5E294E_LNX }} | |
package: . |