Merge pull request #1 from gleize/gleize-traceback-exception-report #2
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: Deploy website | |
on: | |
push: | |
branches: | |
- main | |
- deploy_website_hydra | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Deploy website | |
env: | |
WEBSITE_GITHUB_TOKEN: ${{ secrets.WEBSITE_GITHUB_TOKEN }} | |
run: | | |
SUBDIR=website | |
git fetch | |
REV=$(git log -5 --pretty=oneline origin/gh-pages | grep "Deploy website" | awk 'NF>1{print $NF}' | head -1) | |
# This condition passes in 2 conditions: | |
# 1. The revision does not exist (squash/force push happened) | |
# 2. There are changes between last deployed revision and HEAD | |
if [[ ! $(git rev-parse --verify -q "$REV^{commit}") || $(git diff-index $REV -- $SUBDIR) ]]; then | |
echo "Changes detected in directory $SUBDIR between origin/main and this diff" | |
cd $SUBDIR | |
yarn --no-progress | |
git config --global user.email [email protected] | |
git config --global user.name omry | |
echo "machine github.com login docusaurus-bot password $WEBSITE_GITHUB_TOKEN" > ~/.netrc | |
yarn install && GIT_USER=docusaurus-bot yarn deploy | |
else | |
echo "No changes detected in directory $SUBDIR between origin/main and this diff" | |
fi |