Merge pull request #19 from nemac/mobile-fixes #55
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Create .env file | |
run: | | |
echo "AIRTABLE_TOKEN='${{ secrets.AIRTABLE_TOKEN }}'" > .env | |
echo "AIRTABLE_BASE='${{ secrets.AIRTABLE_BASE }}'" >> .env | |
echo "AGOL_API_KEY='${{ secrets.AGOL_API_KEY }}'" >> .env | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- 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: us-east-1 # Adjust this to your S3 bucket's region | |
- name: Upload to S3 | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/master" ]; then | |
aws s3 sync dist/ s3://crf-matching | |
elif [ "${{ github.ref }}" = "refs/heads/develop" ]; then | |
aws s3 sync dist/ s3://crf-matching-dev | |
fi | |
- name: Invalidate CloudFront | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/master" ]; then | |
aws cloudfront create-invalidation \ | |
--distribution-id E6AN64MGEH6XD \ | |
--paths "/*" | |
elif [ "${{ github.ref }}" = "refs/heads/develop" ]; then | |
aws cloudfront create-invalidation \ | |
--distribution-id E2NM5QT3AUD8LF \ | |
--paths "/*" | |
fi |