CI: workflow_dispatch-inputs en config-uitvoer met sitenaam (deploy_sls_test, deploy_sls_production, *_sls_*, artefacten app-sls-*); docs bijgewerkt
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,12 +3,12 @@ name: Continuous Integration
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
deploy_test:
|
||||
description: 'Deploy to Test'
|
||||
deploy_sls_test:
|
||||
description: 'Deploy SLS test (SlpSoftware)'
|
||||
type: boolean
|
||||
default: false
|
||||
deploy_production:
|
||||
description: 'Deploy to Production'
|
||||
deploy_sls_production:
|
||||
description: 'Deploy SLS production (SlpSoftware)'
|
||||
type: boolean
|
||||
default: false
|
||||
deploy_asf_test:
|
||||
@@ -38,10 +38,10 @@ env:
|
||||
NODE_VERSION: '20'
|
||||
PNPM_VERSION: '9'
|
||||
PUBLISH_RID: linux-arm64
|
||||
ARTIFACT_NAME_TEST: app-test
|
||||
ARTIFACT_NAME_PRODUCTION: app-production
|
||||
DEPLOY_ENVIRONMENT_TEST: test
|
||||
DEPLOY_ENVIRONMENT_PRODUCTION: production
|
||||
ARTIFACT_NAME_SLS_TEST: app-sls-test
|
||||
ARTIFACT_NAME_SLS_PRODUCTION: app-sls-production
|
||||
DEPLOY_ENVIRONMENT_SLS_TEST: test
|
||||
DEPLOY_ENVIRONMENT_SLS_PRODUCTION: production
|
||||
DEPLOY_PATH_TEST: ${{ vars.DEPLOY_PATH_TEST }}
|
||||
DEPLOY_PATH_PRODUCTION: ${{ vars.DEPLOY_PATH_PRODUCTION }}
|
||||
SERVICE_NAME_TEST: ${{ vars.SERVICE_NAME_TEST }}
|
||||
@@ -55,24 +55,24 @@ jobs:
|
||||
config-sls:
|
||||
runs-on: linux
|
||||
outputs:
|
||||
artifact_name_test: ${{ steps.set.outputs.artifact_name_test }}
|
||||
artifact_name_production: ${{ steps.set.outputs.artifact_name_production }}
|
||||
deploy_environment_test: ${{ steps.set.outputs.deploy_environment_test }}
|
||||
deploy_environment_production: ${{ steps.set.outputs.deploy_environment_production }}
|
||||
deploy_path_test: ${{ steps.set.outputs.deploy_path_test }}
|
||||
deploy_path_production: ${{ steps.set.outputs.deploy_path_production }}
|
||||
service_name_test: ${{ steps.set.outputs.service_name_test }}
|
||||
service_name_production: ${{ steps.set.outputs.service_name_production }}
|
||||
health_check_url_test: ${{ steps.set.outputs.health_check_url_test }}
|
||||
health_check_url_production: ${{ steps.set.outputs.health_check_url_production }}
|
||||
artifact_name_sls_test: ${{ steps.set.outputs.artifact_name_sls_test }}
|
||||
artifact_name_sls_production: ${{ steps.set.outputs.artifact_name_sls_production }}
|
||||
deploy_environment_sls_test: ${{ steps.set.outputs.deploy_environment_sls_test }}
|
||||
deploy_environment_sls_production: ${{ steps.set.outputs.deploy_environment_sls_production }}
|
||||
deploy_path_sls_test: ${{ steps.set.outputs.deploy_path_sls_test }}
|
||||
deploy_path_sls_production: ${{ steps.set.outputs.deploy_path_sls_production }}
|
||||
service_name_sls_test: ${{ steps.set.outputs.service_name_sls_test }}
|
||||
service_name_sls_production: ${{ steps.set.outputs.service_name_sls_production }}
|
||||
health_check_url_sls_test: ${{ steps.set.outputs.health_check_url_sls_test }}
|
||||
health_check_url_sls_production: ${{ steps.set.outputs.health_check_url_sls_production }}
|
||||
steps:
|
||||
# Gitea has no reliable way to see a past run's workflow_dispatch input values from the UI, so
|
||||
# this logs them explicitly — the only durable record of what was actually checked for a run.
|
||||
- name: Log dispatch inputs
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "Deploy to Test: ${{ github.event.inputs.deploy_test }}"
|
||||
echo "Deploy to Production: ${{ github.event.inputs.deploy_production }}"
|
||||
echo "Deploy SLS test: ${{ github.event.inputs.deploy_sls_test }}"
|
||||
echo "Deploy SLS production: ${{ github.event.inputs.deploy_sls_production }}"
|
||||
# The Gitea variables are read at STEP level (like config-asf), not through the workflow-level env block: on the PC
|
||||
# runner the workflow-level `${{ vars.* }}` values came through empty (deploy path "" -> mkdir /releases), while
|
||||
# step-level env works on both runners. The test trio must be set, otherwise fail here instead of in the deploy.
|
||||
@@ -91,16 +91,16 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "artifact_name_test=${{ env.ARTIFACT_NAME_TEST }}" >> "$GITHUB_OUTPUT"
|
||||
echo "artifact_name_production=${{ env.ARTIFACT_NAME_PRODUCTION }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_environment_test=${{ env.DEPLOY_ENVIRONMENT_TEST }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_environment_production=${{ env.DEPLOY_ENVIRONMENT_PRODUCTION }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_path_test=$DEPLOY_PATH_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_path_production=$DEPLOY_PATH_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "service_name_test=$SERVICE_NAME_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "service_name_production=$SERVICE_NAME_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "health_check_url_test=$HEALTH_CHECK_URL_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "health_check_url_production=$HEALTH_CHECK_URL_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "artifact_name_sls_test=${{ env.ARTIFACT_NAME_SLS_TEST }}" >> "$GITHUB_OUTPUT"
|
||||
echo "artifact_name_sls_production=${{ env.ARTIFACT_NAME_SLS_PRODUCTION }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_environment_sls_test=${{ env.DEPLOY_ENVIRONMENT_SLS_TEST }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_environment_sls_production=${{ env.DEPLOY_ENVIRONMENT_SLS_PRODUCTION }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_path_sls_test=$DEPLOY_PATH_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_path_sls_production=$DEPLOY_PATH_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "service_name_sls_test=$SERVICE_NAME_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "service_name_sls_production=$SERVICE_NAME_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "health_check_url_sls_test=$HEALTH_CHECK_URL_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "health_check_url_sls_production=$HEALTH_CHECK_URL_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Path-based skip: keeps the pipeline short when a change only touches one side of the repo.
|
||||
# fetch-depth: 0 gives paths-filter full local git history to diff against, rather than relying
|
||||
@@ -365,7 +365,7 @@ jobs:
|
||||
# but a gate that actually ran and failed or was cancelled still blocks the publish. The
|
||||
# changes.outputs check makes sure there's something to publish at all: a run that touched
|
||||
# neither backend nor frontend has nothing new to deploy. The final line skips this build on a
|
||||
# manual workflow_dispatch run that didn't check deploy_test — building and uploading a test
|
||||
# manual workflow_dispatch run that didn't check deploy_sls_test — building and uploading a test
|
||||
# artifact nobody is going to deploy is wasted work; push/PR runs are unaffected.
|
||||
if: |
|
||||
always() &&
|
||||
@@ -377,7 +377,7 @@ jobs:
|
||||
needs.frontend-test.result != 'failure' && needs.frontend-test.result != 'cancelled' &&
|
||||
needs.frontend-lint.result != 'failure' && needs.frontend-lint.result != 'cancelled' &&
|
||||
(needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true') &&
|
||||
(github.event_name != 'workflow_dispatch' || github.event.inputs.deploy_test == 'true')
|
||||
(github.event_name != 'workflow_dispatch' || github.event.inputs.deploy_sls_test == 'true')
|
||||
runs-on: linux
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -428,16 +428,16 @@ jobs:
|
||||
working-directory: src/SlpModularCms.Api.SlpSoftware
|
||||
run: >
|
||||
dotnet publish -c Release -r ${{ env.PUBLISH_RID }} --self-contained false
|
||||
-o ${{ github.workspace }}/${{ env.ARTIFACT_NAME_TEST }}
|
||||
-o ${{ github.workspace }}/${{ env.ARTIFACT_NAME_SLS_TEST }}
|
||||
|
||||
- name: Upload publish artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME_TEST }}
|
||||
path: ${{ env.ARTIFACT_NAME_TEST }}
|
||||
name: ${{ env.ARTIFACT_NAME_SLS_TEST }}
|
||||
path: ${{ env.ARTIFACT_NAME_SLS_TEST }}
|
||||
retention-days: 1
|
||||
|
||||
# Same as publish-sls-test, but only for a manual workflow_dispatch run with deploy_production set —
|
||||
# Same as publish-sls-test, but only for a manual workflow_dispatch run with deploy_sls_production set —
|
||||
# a distinct job rather than a parameterized reuse of publish-sls-test, because VITE_APP_ENV is a
|
||||
# Vite build-time value: one dist/ bundle cannot be tagged as both 'test' and 'production' (FR-05).
|
||||
publish-sls-production:
|
||||
@@ -453,7 +453,7 @@ jobs:
|
||||
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.deploy_production == 'true' &&
|
||||
github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_sls_production == 'true' &&
|
||||
(needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true')
|
||||
runs-on: linux
|
||||
steps:
|
||||
@@ -499,17 +499,17 @@ jobs:
|
||||
working-directory: src/SlpModularCms.Api.SlpSoftware
|
||||
run: >
|
||||
dotnet publish -c Release -r ${{ env.PUBLISH_RID }} --self-contained false
|
||||
-o ${{ github.workspace }}/${{ env.ARTIFACT_NAME_PRODUCTION }}
|
||||
-o ${{ github.workspace }}/${{ env.ARTIFACT_NAME_SLS_PRODUCTION }}
|
||||
|
||||
- name: Upload publish artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME_PRODUCTION }}
|
||||
path: ${{ env.ARTIFACT_NAME_PRODUCTION }}
|
||||
name: ${{ env.ARTIFACT_NAME_SLS_PRODUCTION }}
|
||||
path: ${{ env.ARTIFACT_NAME_SLS_PRODUCTION }}
|
||||
retention-days: 1
|
||||
|
||||
# Automatic test deploy on every push to master (unchanged — a merge should reach test without
|
||||
# extra steps). A manual workflow_dispatch run only deploys to test when deploy_test is checked,
|
||||
# extra steps). A manual workflow_dispatch run only deploys to test when deploy_sls_test is checked,
|
||||
# since a dispatch run is often just re-running CI/production, not a new test build (FR-03, D-01,
|
||||
# D-09).
|
||||
# deploy_path / service_name / health_check_url come straight from the Gitea variables, NOT from the `config-sls` job
|
||||
@@ -518,28 +518,28 @@ jobs:
|
||||
# `config-sls` outputs are still used for the artifact and environment names.
|
||||
deploy-sls-test:
|
||||
needs: [publish-sls-test, config-sls]
|
||||
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master')
|
||||
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_sls_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master')
|
||||
uses: ./.gitea/workflows/deploy-scp.yaml
|
||||
secrets: inherit
|
||||
with:
|
||||
artifact_name: ${{ needs.config-sls.outputs.artifact_name_test }}
|
||||
environment: ${{ needs.config-sls.outputs.deploy_environment_test }}
|
||||
artifact_name: ${{ needs.config-sls.outputs.artifact_name_sls_test }}
|
||||
environment: ${{ needs.config-sls.outputs.deploy_environment_sls_test }}
|
||||
deploy_path: ${{ vars.DEPLOY_PATH_TEST }}
|
||||
service_name: ${{ vars.SERVICE_NAME_TEST }}
|
||||
health_check_url: ${{ vars.HEALTH_CHECK_URL_TEST }}
|
||||
run_db_backup: false
|
||||
|
||||
# Production deploy ONLY on an explicit workflow_dispatch run with deploy_production checked
|
||||
# Production deploy ONLY on an explicit workflow_dispatch run with deploy_sls_production checked
|
||||
# (FR-04, D-09) — never reachable from a plain push to master, so pushing cannot deploy production
|
||||
# under any circumstance.
|
||||
deploy-sls-production:
|
||||
needs: [publish-sls-production, config-sls]
|
||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_production == 'true'
|
||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_sls_production == 'true'
|
||||
uses: ./.gitea/workflows/deploy-scp.yaml
|
||||
secrets: inherit
|
||||
with:
|
||||
artifact_name: ${{ needs.config-sls.outputs.artifact_name_production }}
|
||||
environment: ${{ needs.config-sls.outputs.deploy_environment_production }}
|
||||
artifact_name: ${{ needs.config-sls.outputs.artifact_name_sls_production }}
|
||||
environment: ${{ needs.config-sls.outputs.deploy_environment_sls_production }}
|
||||
deploy_path: ${{ vars.DEPLOY_PATH_PRODUCTION }}
|
||||
service_name: ${{ vars.SERVICE_NAME_PRODUCTION }}
|
||||
health_check_url: ${{ vars.HEALTH_CHECK_URL_PRODUCTION }}
|
||||
|
||||
Reference in New Issue
Block a user