Skip to content

Update deploy-production.yml #15

Update deploy-production.yml

Update deploy-production.yml #15

name: Production CI
on:
push:
branches: [ main ]
# 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
- 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
- uses: actions/[email protected]
- name: Change homepage in package.json
run: sed -i 's/place-holder/OATutor/g' package.json
- 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
- uses: actions/checkout@v2
with:
ref: 'gh-pages'
path: 'gh-build'
- name: Push
run: |
cd gh-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