Skip to content

Platform Website CD #125

Platform Website CD

Platform Website CD #125

name: Platform Website CD
env:
APP_SERVICE_NAME: 'bitplatform'
on:
workflow_dispatch:
push:
branches: [ "main" ]
permissions:
contents: read
jobs:
build_api_blazor:
name: build api + blazor
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: src/global.json
- name: Install wasm
run: cd src && dotnet workload install wasm-tools wasm-experimental
- name: Generate CSS/JS files
run: dotnet build src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj -t:BeforeBuildTasks --no-restore
- name: Publish
run: dotnet publish src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj -c Release --self-contained -r linux-x64 -o server
- name: Upload server artifact
uses: actions/upload-artifact@v3
with:
name: server-bundle
path: server
deploy_api_blazor:
name: deploy api + blazor
needs: build_api_blazor
runs-on: ubuntu-22.04
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Retrieve server bundle
uses: actions/download-artifact@v2
with:
name: server-bundle
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.APP_SERVICE_NAME }}
slot-name: 'production'
publish-profile: ${{ secrets.BITPLATFORM_AZURE_APP_SERVICE_PUBLISH_PROFILE }}
package: .
- name: Purge cache
uses: jakejarvis/cloudflare-purge-action@master
env:
CLOUDFLARE_ZONE: ${{ secrets.BITPLATFORM_DEV_CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}