Setting up production url deployment (#5) #2
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 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ["20"] | |
env: | |
AWS_PROFILE: transitmatters | |
AWS_DEFAULT_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
TM_PRIDEBUS_CERN_ARN: ${{ secrets.TM_PRIDEBUS_CERN_ARN }} | |
TM_LABS_WILDCARD_CERT_ARN: ${{ secrets.TM_LABS_WILDCARD_CERT_ARN }} | |
MBTA_V3_API_KEY: ${{ secrets.MBTA_V3_API_KEY }} | |
DD_API_KEY: ${{ secrets.DD_API_KEY }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.12 | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Set up Node ${{ matrix.node-version }}.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Set up CI Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.npm | |
${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
restore-keys: | | |
${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}- | |
- name: Check if package-lock.json is up to date | |
run: | | |
npx --yes [email protected] | |
- name: Generate AWS profile | |
run: | | |
mkdir ~/.aws | |
cat >> ~/.aws/credentials << EOF | |
[$AWS_PROFILE] | |
aws_access_key_id = $AWS_ACCESS_KEY_ID | |
aws_secret_access_key = $AWS_SECRET_ACCESS_KEY | |
EOF | |
- name: Run deploy shell script | |
run: | | |
npm ci | |
npm run build | |
bash deploy.sh |