Skip to content

Merge pull request #536 from SCCapstone/main #21

Merge pull request #536 from SCCapstone/main

Merge pull request #536 from SCCapstone/main #21

# Builds and deploys API and SPA to Azure
name: Release
on:
push:
branches:
- prod
jobs:
build-api:
name: Build API Job
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
include-prerelease: true
- name: Build with .NET
run: |
cd FU.API
dotnet build --configuration Release
shell: pwsh
- name: Publish
run: |
cd FU.API
dotnet publish -c Release
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: .net-app
path: D:\a\PalmettoProgrammers\PalmettoProgrammers\FU.API\FU.API\bin
deploy-api:
name: Deploy API Job
runs-on: windows-latest
needs: build-api
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: .net-app
- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_87D22017AF9A4422BFA98ED1ADF7422D }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_1C7528FFBA32419CB7F9CE5531B3980E }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_1AD9A60BDBC9485E80D6B3728DDF6729 }}
- name: Deploy API
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'fuapi'
slot-name: 'Production'
package: .
build-and-deploy-spa:
name: Build & Deploy SPA Job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Build and Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_JOLLY_GLACIER_0AE92C40F }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "/FU.SPA" # App source code path
output_location: "dist"
comment:
name: Comment on Merge Request
runs-on: ubuntu-latest
needs: [deploy-api, build-and-deploy-spa]
steps:
- uses: actions/checkout@v4
- name: Comment on Merge Request
run: |
branch_name=$(echo "${{ github.event.head_ref }}" | sed 's/refs\/heads\///')
gh pr comment $branch_name -b "Deployed to https://jolly-glacier-0ae92c40f.4.azurestaticapps.net/"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}