Deploy to production (6.9.7.4c550ab12aac5cf37df86a9722729e594cc279fe) #103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to EC2 | |
run-name: Deploy to ${{ inputs.environment }} (${{ inputs.version }}) | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Tarball (either the full filename or just its {rc_version}.{commit_hash} substring) | |
type: string | |
required: true | |
environment: | |
description: Deploy to | |
type: choice | |
options: | |
- staging | |
- production | |
required: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.environment }} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
deploy: | |
name: Deploy to EC2 | |
environment: ${{ inputs.environment }} | |
runs-on: rocketchat # https://github.com/seekingalpha/Rocket.Chat/settings/actions/runners | |
steps: | |
- name: CONFIG VARS # Log our configuration inputs right here at the top, so they are easy to find | |
env: | |
environment: ${{ inputs.environment }} | |
version: ${{ inputs.version }} | |
run: | | |
echo | |
echo 'Running the "Deploy to EC2" workflow with the following config vars:' | |
echo " - version: $version" | |
echo " - environment: $environment" | |
- name: Checkout deploy script branch | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y cloud-utils | |
sudo apt-get install -y pssh | |
sudo apt-get install -y gettext # provides envsubst(1) template renderer | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Obtain the SSH private key for logging in to RC EC2 instances | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: '${{ secrets.CI_SSH_PRIVATE_KEY }}' | |
- name: Run deploy script | |
run: ./github.sh | |
env: | |
environment: ${{ inputs.environment }} | |
version: ${{ inputs.version }} |