Merge pull request #108 from UCLALibrary/backend-v2 #4
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 | |
jobs: | |
buildtestenv: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 12 | |
- run: npm install | |
working-directory: ucla-prrla | |
- run: node_modules/.bin/ng build --no-progress | |
working-directory: ucla-prrla | |
- name: Cache Test Environment Artifacts | |
uses: actions/cache@v2 | |
with: | |
path: ucla-prrla/dist | |
key: testprl | |
buildprodenv: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ucla-prrla | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 12 | |
- run: npm install | |
- run: node_modules/.bin/ng build --env=prod --no-sourcemap --no-progress | |
- name: Cache Prod Environment Artifacts | |
uses: actions/cache@v2 | |
with: | |
path: ucla-prrla/dist | |
key: prodprl | |
deploytest: | |
needs: buildtestenv | |
runs-on: ubuntu-latest | |
steps: | |
- name: Test PRL Cache | |
id: cache-test-prl | |
uses: actions/cache@v2 | |
with: | |
path: ucla-prrla/dist | |
key: testprl | |
- run: mkdir prl; tar -zcf prl/test-prl-latest.tar.gz ucla-prrla/dist | |
- name: Copy Artifact to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks | |
env: | |
AWS_S3_BUCKET: ${{ secrets.BUILDARTIFACTS_AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: "us-west-2" | |
SOURCE_DIR: "prl" | |
DEST_DIR: "prl" | |
- name: deploy | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.TESTPRL_AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: "us-west-2" | |
SOURCE_DIR: "ucla-prrla/dist" | |
deployprod: | |
needs: ["buildprodenv", "deploytest"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prod PRL Cache | |
id: cache-prod-prl | |
uses: actions/cache@v2 | |
with: | |
path: ucla-prrla/dist | |
key: prodprl | |
- run: mkdir prl; tar -zcf prl/prod-prl-latest.tar.gz ucla-prrla/dist | |
- name: Copy Artifact to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks | |
env: | |
AWS_S3_BUCKET: ${{ secrets.BUILDARTIFACTS_AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: "us-west-2" | |
SOURCE_DIR: "prl" | |
DEST_DIR: "prl" | |
- name: deploy | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.PRODPRL_AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: "us-west-2" | |
SOURCE_DIR: "ucla-prrla/dist" |