Skip to content

Deploy single application #51

Deploy single application

Deploy single application #51

name: Deploy single application
description: Deploy a specific version of an application to the develop or staging environments without updating the config
on:
workflow_dispatch:
inputs:
environment:
description: Which environment to deploy to
type: choice
options:
- develop
- staging
required: true
default: develop
application:
description: Which application to deploy
type: choice
options:
- frontend
- enrichment
- wagtail
- catalogue
- search
- wagtaildocs
- requestservicerecord
- forms
required: true
image_tag:
description: Docker image tag to deploy (e.g. 26.02.05.1234)
required: true
permissions: {}
concurrency:
group: deploy-${{ inputs.environment }}
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
url: ${{ inputs.environment == 'develop' && 'https://dev-www.nationalarchives.gov.uk/' || 'https://staging-www.nationalarchives.gov.uk/' }}
timeout-minutes: 15
permissions:
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Configure AWS credentials
if: ${{ inputs.environment == 'develop' }}
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7
with:
aws-region: eu-west-2
role-to-assume: arn:aws:iam::846769538626:role/GithubOIDCProviderIAMRolePermissions-Role-I80RXHT6O1PL
role-session-name: GitHubActionsSession
- name: Configure AWS credentials
if: ${{ inputs.environment == 'staging' }}
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7
with:
aws-region: eu-west-2
role-to-assume: arn:aws:iam::337670467269:role/GitHubActionRole
role-session-name: GitHubActionsSession
- name: Deploy service
uses: ./.github/actions/deploy
with:
config-file: ${{ inputs.environment }}.json
version: ${{ inputs.image_tag }}
service-name: ${{ inputs.application }}
parameter-path: /application/web/${{ inputs.application }}/docker_images
deployed-parameter-path: /application/web/${{ inputs.application }}/deployed_version
notify:
runs-on: ubuntu-latest
needs:
- deploy
steps:
- uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2.3.3
env:
SLACK_TITLE: Application deployment
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON: https://raw.githubusercontent.com/nationalarchives/tna-frontend/main/src/nationalarchives/assets/images/apple-touch-icon.png
SLACK_ICON_EMOJI: ":rocket:"
SLACK_COLOR: success
MSG_MINIMAL: true
ENABLE_ESCAPES: true
SLACKIFY_MARKDOWN: true
SLACK_MESSAGE: "🧑‍💻 **${{ github.actor }}** has deployed a version of **${{ inputs.application }}** (${{ inputs.image_tag }}) to **${{ inputs.environment }}** for testing..."