ci: add deployment alias to deployment message

This commit is contained in:
Fernando Fernández 2024-10-24 13:41:27 +00:00 committed by GitHub
parent 0c52dd9447
commit 91324c5164
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -29,6 +29,7 @@ jobs:
url: ${{ steps.cf.outputs.deployment-url }}
outputs:
url: ${{ steps.cf.outputs.deployment-url }}
alias-url: ${{ steps.cf.outputs.deployment-alias-url }}
steps:
- name: Download workflow artifact ⬇️
@ -58,5 +59,6 @@ jobs:
branch: ${{ inputs.branch }}
commit: ${{ inputs.commit }}
preview_url: ${{ needs.cf-pages.outputs.url }}
preview_alias: ${{ needs.cf-pages.outputs.alias-url }}
in_progress: false
comment: ${{ inputs.comment }}

View File

@ -12,6 +12,9 @@ on:
preview_url:
required: false
type: string
preview_alias:
required: false
type: string
in_progress:
required: true
type: boolean
@ -38,7 +41,8 @@ jobs:
id: compose
env:
COMMIT: ${{ inputs.commit }}
PREVIEW_URL: ${{ inputs.preview_url != '' && (inputs.branch != 'master' && inputs.preview_url || format('{0} ({1})', env.CF_PAGES_DEPLOYMENT_URL, inputs.preview_url)) || 'Not available' }}
PREVIEW_URL: ${{ inputs.preview_url != '' && (inputs.branch != 'master' && inputs.preview_url || format('{0} ({1})', env.CF_PAGES_DEPLOYMENT_URL, inputs.preview_url)) || '❓ Not available' }}
PREVIEW_ALIAS: ${{ inputs.preview_alias || '❓ Not available' }}
DEPLOY_STATUS: ${{ inputs.in_progress && '🔄 Deploying...' || (inputs.preview_url != '' && '✅ Deployed!' || '❌ Failure. Check workflow logs for details') }}
DEPLOYMENT_TYPE: ${{ inputs.branch != 'master' && '🔀 Preview' || '⚙️ Production' }}
WORKFLOW_RUN: ${{ !inputs.in_progress && format('**[View build logs](https://github.com/{0}/actions/runs/{1})**', github.repository, github.run_id) || '' }}
@ -50,6 +54,7 @@ jobs:
echo "|------------------------- |:----------------------------: |" >> $GITHUB_STEP_SUMMARY
echo "| **Status** | $DEPLOY_STATUS |" >> $GITHUB_STEP_SUMMARY
echo "| **Preview URL** | $PREVIEW_URL |" >> $GITHUB_STEP_SUMMARY
echo "| **Preview alias** | $PREVIEW_ALIAS |" >> $GITHUB_STEP_SUMMARY
echo "| **Type** | $DEPLOYMENT_TYPE |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "$WORKFLOW_RUN" >> $GITHUB_STEP_SUMMARY