Skip to content

Merge pull request #219 from scribear/https-support #89

Merge pull request #219 from scribear/https-support

Merge pull request #219 from scribear/https-support #89

Workflow file for this run

name: Deploy
on:
push:
branches: [ "master" ]
workflow_dispatch: # For action testing you can also run this manually
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build
run: |
npm install
npm run build
date > build/builddate.txt
git rev-parse --short HEAD > build/commit.txt
- name: Deploy to Production
if: github.ref == 'refs/heads/master'
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"
run: |
mkdir -p ~/bin
export PATH="${HOME}/bin:${PATH}"
wget -O ~/bin/git-filter-repo https://raw.githubusercontent.com/newren/git-filter-repo/7b3e714b94a6e5b9f478cb981c7f560ef3f36506/git-filter-repo
chmod +x ~/bin/git-filter-repo
ls -la
eval "$(ssh-agent -s)"
ssh-add - <<< "${DEPLOY_KEY}"
git clone git@github.com:scribear/v.git
git config --global user.email "angrave@illinois.edu"
git config --global user.name "scribear-bot"
cd v
ls -la
export SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`
# git-filter-repo expects a fresh clone
# git-filter-repo --path latest --invert-paths
# TODO Need to debug why the above fails;
# we can get error later when git push origin master
# "fatal: 'origin' does not appear to be a git repository"
# The following should not be required if git-filter-repo works
git rm -rf latest
git commit -m "Removing previous latest dir"
mkdir -p latest
mv ../build/* latest
git add latest
git commit -m "Commit Deploy: ${SHORT_SHA}"
git push origin master