forked from facebookresearch/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (32 loc) · 1.26 KB
/
deploy_website.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 omry@users.noreply.github.com
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