88 lines
3.1 KiB
YAML
88 lines
3.1 KiB
YAML
name: Deploy to S3
|
|
|
|
# main only. Everything else is covered by ci.yml, which runs the same checks
|
|
# without deploying.
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
# Nothing was verified before this existed: a frontend that failed to compile
|
|
# would zip and ship exactly like a working one. `deploy` now needs this job,
|
|
# so a red main does not reach the bucket.
|
|
checks:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
# 22 to match frontend/Dockerfile, so CI resolves the same tree the
|
|
# production image builds from.
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
# 3.11 is the floor in pyproject.toml and the version the project's conda
|
|
# env runs.
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
pip install -r backend/requirements.txt
|
|
|
|
- name: Run checks
|
|
run: bash scripts/ci-checks.sh
|
|
|
|
deploy:
|
|
needs: checks
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
# NOTE: this zip still contains frontend/node_modules, roughly 90 MB and
|
|
# the bulk of the artifact. It is left in deliberately. Nothing in this
|
|
# repo says what unpacks the zip on the other side — there is no appspec
|
|
# file and no deploy script here — so if that side runs the app without
|
|
# installing dependencies, dropping node_modules would break the deploy.
|
|
# Confirm what consumes the bucket object, then add -x "frontend/node_modules/*".
|
|
- name: Archive project
|
|
run: |
|
|
apt-get update -y
|
|
apt-get install -y zip
|
|
zip -r utopia-ai-hr-ats-portal.zip . \
|
|
-x ".git/*" \
|
|
-x ".gitea/*" \
|
|
-x ".gitignore" \
|
|
-x "*.DS_Store"
|
|
|
|
- name: Install AWS CLI
|
|
run: |
|
|
apt-get update -y
|
|
apt-get install -y curl unzip
|
|
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
|
unzip -q awscliv2.zip
|
|
./aws/install
|
|
aws --version
|
|
|
|
# The credentials live only on this step. There used to be a separate
|
|
# "Configure AWS credentials" step above that set the same three variables
|
|
# and then only echoed a message — env: is scoped to its own step, so
|
|
# those values were discarded before anything could use them. It was doing
|
|
# nothing, and it read as though credentials were set up globally.
|
|
- name: Upload files to S3
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.DEVOPS_USER_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEVOPS_USER_AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: us-east-1
|
|
run: |
|
|
echo "Uploading repo contents to S3..."
|
|
aws s3 cp utopia-ai-hr-ats-portal.zip s3://utopia-ai-s3-repo-bucket/utopia-ai-hr-ats-portal.zip
|