Skip to content

Initial commit of a new comic, Updating Dependencies #327

Initial commit of a new comic, Updating Dependencies

Initial commit of a new comic, Updating Dependencies #327

name: Build and Deploy
on:
push:
branches: [main]
workflow_dispatch:
workflow_call:
jobs:
build-and-publish:
# Run on Windows because the Dynamic Content Creator uses a library that converts SVGs to PNGs, and the PNGs look WAY better when this runs on Windows
runs-on: windows-latest
environment: prod
env:
CONFIGURATION: Release
DOTNET_VERSION: 8.0.x
SITE_PROJECT_NAME: ProgrammerAl.Site
SRC_DIRECTORY_PATH: ${{ github.workspace }}/src/
BUILD_ARTIFACTS_PATH: ${{ github.workspace }}/build_artifacts
DYNAMIC_CONTENT_UPDATER_PROJECT_PATH: ${{ github.workspace }}/src/ProgrammerAl.Site/DynamicContentUpdater/DynamicContentUpdater.csproj
PULUMI_PROJECT_DIRECTORY: ${{ github.workspace }}/infra/pulumi-infra-deploy
PULUMI_PROJECT_FILE_PATH: ${{ github.workspace }}/infra/pulumi-infra-deploy/pulumi-infra-deploy.csproj
DYNAMIC_CONTENT_UPDATER_OUTPUT_PATH: ${{ github.workspace }}/static_content_output
STORAGE_URL: https://programmeral-site-storage-api.programmeral.com
PULUMI_STACK_NAME: prod
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
ARM_CLIENT_ID: ${{ secrets.arm_client_id }}
ARM_CLIENT_SECRET: ${{ secrets.arm_client_secret }}
ARM_TENANT_ID: ${{ secrets.arm_tenant_id }}
ARM_SUBSCRIPTION_ID: ${{ secrets.arm_subscription_id }}
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.3.0
- name: Install Cloudflare Wrangler
run: npm install --location=global wrangler
- name: Install Pulumi
uses: pulumi/setup-pulumi@v2
- name: Dotnet Restore - Pulumi Project
run: dotnet restore ${{ env.PULUMI_PROJECT_FILE_PATH }}
- name: Install .NET Wasm Tools
run: dotnet workload install wasm-tools
# Run the dynamic content creator first because some stuff it outputs goes to the blazor site
- name: Run Dynamic Content Creator
run: dotnet run --project ${{ env.DYNAMIC_CONTENT_UPDATER_PROJECT_PATH }} --verbosity normal -- --AppRootPath "${{ env.SRC_DIRECTORY_PATH}}" --OutputDirectory "${{ env.DYNAMIC_CONTENT_UPDATER_OUTPUT_PATH }}" --StorageUrl "${{ env.STORAGE_URL }}"
- name: Cake - Build
run: dotnet run --project build/build/Build.csproj -- --configuration=${{ env.CONFIGURATION }} --srcDirectoryPath=${{ env.SRC_DIRECTORY_PATH }} --BuildArtifactsPath=${{ env.BUILD_ARTIFACTS_PATH }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: website
path: ${{ env.BUILD_ARTIFACTS_PATH }}
- name: Cake - Deploy
run: dotnet run --project ${{ github.workspace }}/deploy/deploy/Deploy.csproj -- --configuration=${{ env.CONFIGURATION }} --PulumiStackName=${{ env.PULUMI_STACK_NAME }} --WorkspacePath=${{ github.workspace }} --BuildArtifactsPath=${{ env.BUILD_ARTIFACTS_PATH }}
- name: Run - Content Uploader to push content to storage api
run: dotnet run --project ${{ github.workspace }}/src/ProgrammerAl.Site/ContentUploader/ContentUploader.csproj -- --PulumiStackName=${{ env.PULUMI_STACK_NAME }} --PulumiStackPath=${{ env.PULUMI_PROJECT_DIRECTORY }} --ContentDirectory="${{ env.DYNAMIC_CONTENT_UPDATER_OUTPUT_PATH }}"