Deploy to preprod #10612
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 preprod | |
concurrency: preprod | |
on: | |
workflow_run: | |
workflows: ["CI"] | |
types: [completed] | |
branches: [master] | |
schedule: | |
# Run every day at 9:45 AM UTC | |
- cron: "45 9 * * *" | |
workflow_dispatch: | |
env: | |
AWS_REGION: us-east-1 | |
HOWDJU_RUNNING_IN_GITHUB_WORKFLOW: | |
DEBUG: howdju:check-committed | |
NODE_VERSION: 18.18.2 | |
YARN_VERSION: 4.5.3 | |
jobs: | |
deployment: | |
# Only deploy if: | |
# - CI was based on a successful push or pull_request (to master) or | |
# - if it's a manual trigger or a scheduled trigger | |
if: ${{ (github.event.workflow_run.event == 'push' || github.event.workflow_run.event == 'pull_request') && github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} | |
runs-on: ubuntu-latest | |
environment: preprod | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install AWS CLI v2 | |
run: | | |
# Install the AWS CLI if it's missing. Github provides it, but when | |
# we run locally using `act`, it is missing. | |
# https://github.com/aws-actions/configure-aws-credentials/issues/113 | |
if ! command -v aws &> /dev/null; then | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip | |
unzip -q /tmp/awscliv2.zip -d /tmp | |
rm /tmp/awscliv2.zip | |
sudo /tmp/aws/install --update | |
rm -rf /tmp/aws/ | |
fi | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Corepack | |
# Enables yarn v2 | |
run: | | |
corepack enable | |
yarn set version ${{ env.YARN_VERSION }} | |
- name: Yarn install | |
run: yarn install | |
- name: Deploy API | |
run: yarn run deploy:api:pre-prod | |
- name: Deploy UI | |
run: yarn run deploy:ui:pre-prod |