Skip to content

Deploy Serverless to all Staging Accounts #18

Deploy Serverless to all Staging Accounts

Deploy Serverless to all Staging Accounts #18

# Copyright (C) 2021-2023 Technology Matters
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see https://www.gnu.org/licenses/.
# This is a basic workflow to deploy Serverless to all helpline staging environments
name: Deploy Serverless to all Staging Accounts
on:
workflow_dispatch:
inputs:
changelog:
description: Release Changelog - Add a comment about the changes to be included in this release.
required: true
jobs:
deploy-helplines:
strategy:
fail-fast: false
matrix:
short_helplines:
[
'CA',
'CL',
'PH',
'ET',
'JM',
'MW',
'IN',
'RO',
'BR',
'ZA',
'CO',
'TH',
'UK',
'HU',
'ZM',
'ZW',
'PL',
'MT',
'NZ',
]
uses: ./.github/workflows/custom_helpline.yml
secrets: inherit
with:
helpline_code: ${{ matrix.short_helplines }}
environment_code: STG
environment: staging
changelog: ${{ inputs.changelog }}
# Send Slack notifying success
send-slack-message:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: [deploy-helplines]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Setup credentials to access AWS for parameters
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
# Set any env vars needed from Parameter Store here
# Slack env
- name: Set GITHUB_ACTIONS_SLACK_BOT_TOKEN
uses: 'marvinpinto/action-inject-ssm-secrets@latest'
with:
ssm_parameter: 'GITHUB_ACTIONS_SLACK_BOT_TOKEN'
env_variable_name: 'GITHUB_ACTIONS_SLACK_BOT_TOKEN'
- name: Set ASELO_DEPLOYS_CHANNEL_ID
uses: 'marvinpinto/action-inject-ssm-secrets@latest'
with:
ssm_parameter: 'ASELO_DEPLOYS_CHANNEL_ID'
env_variable_name: 'ASELO_DEPLOYS_CHANNEL_ID'
- name: Slack Aselo channel
id: slack
uses: slackapi/slack-github-action@v1.14.0
with:
channel-id: ${{ env.ASELO_DEPLOYS_CHANNEL_ID }}
slack-message: '`[SERVERLESS PARALLEL DEPLOYMENT]` All Serverless Staging helplines successfully deployed from ${{ github.ref_type }} `${{ github.ref_name }}` requested by `${{ github.triggering_actor }}` with SHA ${{ github.sha }} :rocket:.'
env:
SLACK_BOT_TOKEN: ${{ env.GITHUB_ACTIONS_SLACK_BOT_TOKEN }}