CI: ASF-productie win-x64 publish (alleen dispatch) en uitgeschakelde FTPS-upload naar IIS

publish-asf-production: self-contained win-x64, web.config-sjabloon, artefactcontrole, artefact 30 dagen.
deploy-asf-production: drie sloten (dispatch-input, release/*, ASF_PROD_DEPLOY_ENABLED), expliciete FTPS,
app_offline.htm, geen delete behalve wwwroot/admin, nooit appsettings.Production.json/uploads/logs/wwwroot/web.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 00:19:42 +01:00
co-authored by Claude Sonnet 5.5
parent d84e23758f
commit 3a898bf707
5 changed files with 437 additions and 0 deletions
@@ -15,6 +15,14 @@ on:
description: 'Deploy ASF test (Andrea Slop Fotografie)'
type: boolean
default: false
build_asf_production:
description: 'Build the ASF production artifact (win-x64, IIS); builds only, uploads nothing'
type: boolean
default: false
deploy_asf_production:
description: 'Deploy ASF production (FTPS to IIS): ONLY with Bryan''s explicit go, on a release/* branch, and when the variable ASF_PROD_DEPLOY_ENABLED is true'
type: boolean
default: false
pull_request:
types: [opened, synchronize, reopened]
push:
@@ -682,6 +690,127 @@ jobs:
health_check_url: ${{ vars.ASF_TEST_HEALTH_URL }}
run_db_backup: false
# ==========================================================================================
# ASF PRODUCTION on IIS (MijnHostingPartner). NOTHING here runs on a push or a pull request.
#
# publish-asf-production: builds the self-contained win-x64 host with the admin frontend and the web.config
# template (deploy/asf-iis/web.config), verifies the output (scripts/check-asf-publish.sh) and keeps it as a
# pipeline artifact for 30 days (that is also the "previous release" for a rollback, see
# docs/deploy-asf-productie.md). Only on a manual dispatch with build_asf_production or deploy_asf_production.
# deploy-asf-production: uploads that artifact over explicit FTPS. OFF by default and behind THREE locks:
# a manual dispatch with deploy_asf_production checked, a release/* branch, and the Gitea variable
# ASF_PROD_DEPLOY_ENABLED=true (set only on Bryan's explicit go). It never creates or replaces
# appsettings.Production.json, uploads/ or logs/, and never touches wwwroot/web (the website upload of the ASF repo).
# ==========================================================================================
publish-asf-production:
needs: [changes, backend-build, backend-test, vulnerability-scan, frontend-build, frontend-test, frontend-lint]
if: |
always() &&
needs.changes.result == 'success' &&
needs.backend-build.result != 'failure' && needs.backend-build.result != 'cancelled' &&
needs.backend-test.result != 'failure' && needs.backend-test.result != 'cancelled' &&
needs.vulnerability-scan.result != 'failure' && needs.vulnerability-scan.result != 'cancelled' &&
needs.frontend-build.result != 'failure' && needs.frontend-build.result != 'cancelled' &&
needs.frontend-test.result != 'failure' && needs.frontend-test.result != 'cancelled' &&
needs.frontend-lint.result != 'failure' && needs.frontend-lint.result != 'cancelled' &&
github.event_name == 'workflow_dispatch' &&
(github.event.inputs.build_asf_production == 'true' || github.event.inputs.deploy_asf_production == 'true')
runs-on: linux
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Build admin frontend (ASF theme)
working-directory: frontend
env:
VITE_APP_ENV: production
VITE_APP_TITLE: Andrea Slop Fotografie
VITE_THEME: asf
VITE_DEFAULT_LANGUAGE: nl
VITE_SENTRY_DSN: ${{ vars.ASF_PROD_SENTRY_DSN }}
run: |
pnpm install --frozen-lockfile
pnpm build
mkdir -p ../src/SlpModularCms.Api.AndreaSlopFotografie/wwwroot/admin
cp -r dist/. ../src/SlpModularCms.Api.AndreaSlopFotografie/wwwroot/admin/
# Self-contained: the runtime ships with the app (the Hosting Bundle on the host is only the IIS module).
- name: Publish (ASF production, win-x64)
working-directory: src/SlpModularCms.Api.AndreaSlopFotografie
run: >
dotnet publish -c Release -r win-x64 --self-contained true
-o ${{ github.workspace }}/app-asf-production-win-x64
- name: Apply the IIS web.config template and drop development settings
run: |
out="${{ github.workspace }}/app-asf-production-win-x64"
cp deploy/asf-iis/web.config "$out/web.config"
rm -f "$out/appsettings.Development.json"
- name: Check the artifact (no secrets or server-only files, required files present)
run: bash scripts/check-asf-publish.sh "${{ github.workspace }}/app-asf-production-win-x64"
- name: Upload publish artifact
uses: actions/upload-artifact@v3
with:
name: app-asf-production-win-x64
path: app-asf-production-win-x64
retention-days: 30
deploy-asf-production:
needs: [publish-asf-production]
if: |
github.event_name == 'workflow_dispatch' &&
github.event.inputs.deploy_asf_production == 'true' &&
startsWith(github.ref, 'refs/heads/release/') &&
vars.ASF_PROD_DEPLOY_ENABLED == 'true'
runs-on: linux
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: app-asf-production-win-x64
path: app-asf-production-win-x64
- name: Check settings
env:
ADDRESS: ${{ secrets.ASF_PROD_HOST_ADDRESS }}
USERNAME: ${{ secrets.ASF_PROD_HOST_USERNAME }}
PASSWORD: ${{ secrets.ASF_PROD_HOST_PASSWORD }}
DEPLOY_PATH: ${{ vars.ASF_PROD_DEPLOY_PATH }}
run: |
for v in ADDRESS USERNAME PASSWORD DEPLOY_PATH; do
if [ -z "${!v}" ]; then echo "ASF_PROD_* setting for $v is not set (secrets ASF_PROD_HOST_ADDRESS/USERNAME/PASSWORD, variable ASF_PROD_DEPLOY_PATH)."; exit 1; fi
done
- name: Ensure lftp
run: |
if ! command -v lftp >/dev/null 2>&1; then
(sudo -n apt-get update -qq && sudo -n apt-get install -y -qq lftp) || apt-get install -y -qq lftp
fi
lftp --version | head -1
# Re-checks the artifact (it was built in another job), then uploads. The password only travels as
# the environment variable LFTP_PASSWORD, never on a command line.
- name: Upload over FTPS (app_offline.htm during the sync)
env:
FTP_HOST: ${{ secrets.ASF_PROD_HOST_ADDRESS }}
FTP_PORT: ${{ secrets.ASF_PROD_HOST_PORT }}
FTP_USER: ${{ secrets.ASF_PROD_HOST_USERNAME }}
LFTP_PASSWORD: ${{ secrets.ASF_PROD_HOST_PASSWORD }}
REMOTE_DIR: ${{ vars.ASF_PROD_DEPLOY_PATH }}
HEALTH_URL: ${{ vars.ASF_PROD_HEALTH_URL }}
run: bash scripts/deploy-asf-iis-ftps.sh app-asf-production-win-x64
# --- Smoke tests of the deployed compositions (anonymous requests, see scripts/smoke-site.sh) ---
# The CI tests the master CMS; this is the check that the composition of each site that was just deployed to test
# is the intended one (modules, website mode, noindex, protected admin routes). A failing smoke test fails the run.