Skip to content

#2582 Merit List MVP 3.0 #3666

#2582 Merit List MVP 3.0

#2582 Merit List MVP 3.0 #3666

Workflow file for this run

name: On pull request
on:
pull_request:
types: [opened, reopened, synchronize, edited]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: potiuk/cancel-workflow-runs@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@master
with:
node-version: '20.10.0'
- name: Installing project dependencies
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc && npm ci
- name: Dependency Check
run: echo "audit check been disabled" #npm audit --omit=dev
- name: Lint
run: npm run lint-ci
- name: Test
run: npm run test-ci
check_preview:
runs-on: ubuntu-latest
needs: test
outputs:
environment: ${{ env.environment }}
steps:
- uses: khan/pull-request-comment-trigger@master
id: check_preview_develop
with:
trigger: 'PREVIEW:DEVELOP'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- if: steps.check_preview_develop.outputs.triggered == 'true'
run: echo "environment=develop" >> $GITHUB_ENV
- uses: khan/pull-request-comment-trigger@master
id: check_preview_staging
with:
trigger: 'PREVIEW:STAGING'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- if: steps.check_preview_staging.outputs.triggered == 'true'
run: echo "environment=staging" >> $GITHUB_ENV
- uses: khan/pull-request-comment-trigger@master
id: check_preview_production
with:
trigger: 'PREVIEW:PRODUCTION'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- if: steps.check_preview_production.outputs.triggered == 'true'
run: echo "environment=production" >> $GITHUB_ENV
preview:
runs-on: ubuntu-latest
needs: check_preview
if: ${{ needs.check_preview.outputs.environment == 'develop' || needs.check_preview.outputs.environment == 'staging' || needs.check_preview.outputs.environment == 'production' }}
environment:
name: ${{ needs.check_preview.outputs.environment }}
env:
environment: ${{ needs.check_preview.outputs.environment }}
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@master
with:
node-version: '20.10.0'
- name: Installing project dependencies
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc && npm ci
- name: Create env file
run: |
touch .env.${{ env.environment }}
echo "NODE_ENV=production" > .env.${{ env.environment }}
echo "VITE_FIREBASE_API_KEY=${{ secrets.FIREBASE_API_KEY }}" >> .env.${{ env.environment }}
echo "VITE_FIREBASE_AUTH_DOMAIN=${{ secrets.FIREBASE_AUTH_DOMAIN }}" >> .env.${{ env.environment }}
echo "VITE_FIREBASE_DATABASE_URL=${{ secrets.FIREBASE_DATABASE_URL }}" >> .env.${{ env.environment }}
echo "VITE_FIREBASE_PROJECT_ID=${{ secrets.FIREBASE_PROJECT_ID }}" >> .env.${{ env.environment }}
echo "VITE_FIREBASE_STORAGE_BUCKET=${{ secrets.FIREBASE_STORAGE_BUCKET }}" >> .env.${{ env.environment }}
echo "VITE_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}" >> .env.${{ env.environment }}
echo "VITE_FIREBASE_APP_ID=${{ secrets.FIREBASE_APP_ID }}" >> .env.${{ env.environment }}
echo "VITE_RECAPTCHA_TOKEN=${{ secrets.RECAPTCHA_TOKEN }}" >> .env.${{ env.environment }}
echo "VITE_GTAG_ID=${{ secrets.GTAG_ID }}" >> .env.${{ env.environment }}
cat .env.${{ env.environment }}
- name: Building the project
run: npm run ${{ env.environment }}:build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
projectId: '${{ secrets.FIREBASE_PROJECT_ID }}'
target: '${{ env.environment }}-admin-app'
expires: 30d
env:
FIREBASE_CLI_PREVIEWS: hostingchannels