Skip to content

Manual Release

Manual Release #374

Workflow file for this run

---
name: Manual Release
on:
workflow_dispatch:
inputs:
environment:
description: Environment to release to
required: true
type: environment
tag:
description: Release Tag
required: true
jobs:
manual:
name: Deploy to ${{github.event.inputs.environment}}
runs-on: ubuntu-latest
environment:
name: ${{github.event.inputs.environment}}
url: ${{ steps.deploy.outputs.deploy-url }}
concurrency: ${{github.event.inputs.environment}}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: set-up-environment
uses: DFE-Digital/github-actions/set-up-environment@master
- uses: Azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Fetch secrets from key vault
uses: azure/CLI@v2
id: fetch-secrets
with:
inlineScript: |
SECRET_VALUE=$(az keyvault secret show --name "SLACK-WEBHOOK" --vault-name "${{ secrets.INFRA_KEY_VAULT}}" --query "value" -o tsv)
echo "::add-mask::$SECRET_VALUE"
echo "SLACK-WEBHOOK=$SECRET_VALUE" >> $GITHUB_OUTPUT
SECRET_VALUE=$(az keyvault secret show --name "SLACK-RELEASE-NOTE-WEBHOOK" --vault-name "${{ secrets.INFRA_KEY_VAULT}}" --query "value" -o tsv)
echo "::add-mask::$SECRET_VALUE"
echo "SLACK-RELEASE-NOTE-WEBHOOK=$SECRET_VALUE" >> $GITHUB_OUTPUT
- name: Get Release Id from Tag
id: tag_id
uses: DFE-Digital/github-actions/DraftReleaseByTag@master
with:
TAG: ${{ github.event.inputs.tag }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check if found
if: steps.tag_id.outputs.release_id == ''
run: |
echo "::error ::Tag ${{ github.event.inputs.tag }} cannot be found in releases"
exit 1
- name: Get Short SHA
id: vars
run: |
echo "image_tag_sha=sha-$(echo ${{steps.tag_id.outputs.release_sha}} | cut -c -7)" >> $GITHUB_OUTPUT
- name: Trigger Deployment to ${{github.event.inputs.environment}}
uses: ./.github/workflows/actions/deploy_v2
id: deploy
with:
environment: "${{github.event.inputs.environment}}"
sha: "${{ steps.vars.outputs.image_tag_sha }}"
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
- name: Slack Release Notification
if: steps.tag_id.outputs.release_id && github.event.inputs.environment == 'production_aks'
uses: rtCamp/action-slack-notify@master
env:
SLACK_COLOR: ${{env.SLACK_SUCCESS}}
SLACK_TITLE: "Release Published to ${{github.event.inputs.environment}}: ${{steps.tag_id.outputs.release_name}}"
SLACK_MESSAGE: ${{ fromJson( steps.tag_id.outputs.release_body) }}
SLACK_WEBHOOK: ${{steps.fetch-secrets.outputs.SLACK-RELEASE-NOTE-WEBHOOK}}
MSG_MINIMAL: true
- name: Slack Notification
if: failure()
uses: rtCamp/action-slack-notify@master
env:
SLACK_COLOR: ${{env.SLACK_FAILURE}}
SLACK_TITLE: "Manual Release Failed: ${{steps.tag_id.outputs.release_name}}"
SLACK_MESSAGE: Failure deploying ${{github.event.inputs.environment}} release
SLACK_WEBHOOK: ${{steps.fetch-secrets.outputs.SLACK-WEBHOOK}}