#2121 Ensure the Candidate Page Accounts For Post 01/04/2023 Social Mobility Fields #2245
Workflow file for this run
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: 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: '16.15.1' | |
- 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: echo "tests disabled" #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: '16.15.1' | |
- 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 }} | |
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 |