Skip to content

Update package-lock.json #530

Update package-lock.json

Update package-lock.json #530

name: Content Staging CI
on:
push:
branches: [ content-staging ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
buildAndDeploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Add SSH private keys for submodule repositories
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: |
${{ secrets.OATUTOR_CONTENT_DEPLOY_KEY }}
${{ secrets.CONTENT_STAGING_SSH_PRIVATE_KEY }}
- run: git submodule update --init --recursive
- name: Save original git author and git email
run: |
echo "git_email=$(git log --format='%ae' HEAD^!)" >> $GITHUB_ENV
echo "git_name=$(git log --format='%an' HEAD^!)" >> $GITHUB_ENV
- name: Get build time
run: echo "build_timestamp=$(date +%s%3N)" >> $GITHUB_ENV
- uses: actions/setup-node@v2.4.1
- name: Change homepage in package.json
run: sed -i 's/place-holder/OATutor-Content-Staging/g' package.json
# - name: Do not log data
# run: sed -i 's/DO_LOG_DATA = true/DO_LOG_DATA = false/g' src/config/config.js
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
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 }}-
- name: Run CI install
run: npm ci
- name: Run build
run: npm run build
env:
REACT_APP_FIREBASE_CONFIG: ${{ secrets.STAGING_FIREBASE_CONFIG }}
CI: false
REACT_APP_BUILD_TYPE: "content-staging"
REACT_APP_MIDDLEWARE_URL: ${{ secrets.STAGING_MIDDLEWARE_URL }}
REACT_APP_COMMIT_HASH: ${{ github.sha }}
REACT_APP_BUILD_TIMESTAMP: ${{ env.build_timestamp }}
- uses: actions/checkout@v3
with:
repository: 'CAHLR/OATutor-Content-Staging'
ref: 'main'
path: 'content-staging-build'
- name: Push
run: |
cd content-staging-build
git rm -rf .
git clean -fxd
rsync -av ../build/ .
git add .
git config --local user.email "${{ env.git_email }}"
git config --local user.name "${{ env.git_name }}"
git diff --cached --quiet --exit-code && echo "no changes to platform, exiting early" && exit 0
git commit -m "deploy commit: CAHLR/OATutor@$GITHUB_SHA"
git push