Update training.md #66
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 Hugo Site | |
on: | |
push: | |
branches: | |
- preview | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Set env vars (preview) | |
if: endsWith(github.ref, '/preview') | |
run: | | |
echo "SITE=preview.dataone.org" >> $GITHUB_ENV | |
- name: Set env vars (production) | |
if: endsWith(github.ref, '/main') | |
run: | | |
echo "SITE=www.dataone.org" >> $GITHUB_ENV | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "0.82.0" | |
extended: true | |
- name: Build Site | |
run: | | |
echo "Building site: ${{ env.SITE }}" | |
npm install | |
if [ "$env.SITE" = "www.dataone.org" ]; then hugo; else hugo --baseURL=https://${{ env.SITE }}; fi | |
- name: Deploy Site | |
uses: dataoneorg/[email protected] | |
with: | |
host: ${{ env.SITE }} | |
port: ${{ secrets.PORT }} | |
source: "docs/" | |
target: "/var/www/${{ env.SITE }}" | |
username: ${{ secrets.USER }} | |
group: ${{ secrets.GROUP }} | |
key: ${{ secrets.KEY }} | |