Skip to content

Dev build

Dev build #893

Workflow file for this run

name: Dev build
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Install dependencies
run: npm install
- name: Build
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY_DEV }}
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY_DEV }}
STRIPE_API_KEY: ${{ secrets.STRIPE_TEST_KEY }}
RECAPTCHA_API_KEY: ${{ secrets.RECAPTCHA_API_KEY_DEV }}
STELA_DOMAIN: ${{ secrets.STELA_DOMAIN_DEV }}
MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN_DEV }}
run: npm run build:dev
- name: Archive `dist`
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
upload-sourcemaps:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v2
with:
token: ${{ secrets.SENTRY_TOKEN }}
organization: permanentorg
project: mdot
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Upload sourcemaps
shell: bash
run: |
cp -r dist/mdot dist/app
cp -r dist/mdot dist/share
cp -r dist/mdot dist/p
declare -x VERSION=mdot@$(sentry-cli releases propose-version)
sentry-cli releases set-commits $VERSION --auto --ignore-missing
sentry-cli releases files $VERSION upload-sourcemaps --validate --log-level info --strip-common-prefix ./dist/ --ignore mdot
upload-code:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Create a tar archive
run: |
cd ..
mkdir mdot
mv web-app/dist mdot/dist
tar -czvf mdot.tar.gz mdot
- 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: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Copy package to S3
run: aws s3 cp ../mdot.tar.gz s3://permanent-repos/dev/mdot.tar.gz
deploy:
needs: [upload-code, upload-sourcemaps]
runs-on: ubuntu-latest
steps:
- name: Trigger dev deploy
run: curl -X POST -H 'Accept:application/vnd.github.v3+json' -H 'Authorization:Bearer ${{ secrets.PERMANENT_DEPLOY_PAT }}' https://api.github.com/repos/PermanentOrg/infrastructure/actions/workflows/deploy-dev.yml/dispatches -d '{"ref":"main"}'