Skip to content

Build/Deploy to Staging #240

Build/Deploy to Staging

Build/Deploy to Staging #240

name: Build/Deploy to Staging
on:
workflow_dispatch: # this makes the action manual
jobs:
build:
name: Install dependencies and generate static site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: pip install nbconvert==7.0.0 packaging
- name: Convert Jupyter notebooks
run: |
shopt -s globstar
jupyter-nbconvert --to markdown **/*.ipynb --ExtractOutputPreprocessor.enabled=False
shopt -u globstar
shell: bash
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install vuepress
run: yarn global add vuepress
- name: Install package.json
run: yarn
- name: Build static site with vuepress
# alias for vuepress build src defined in package.json
run: yarn build
- name: Write commit SHA to gitcommit.txt in dist
shell: bash
run: |
echo $GITHUB_SHA > src/.vuepress/dist/gitcommit.txt
- name: Get size of files in dist
shell: bash
run: |
du -ah src/.vuepress/dist
- name: Archive build artifacts
uses: actions/upload-artifact@v2
with:
name: vuepress-dist
path: src/.vuepress/dist
deploy-staging:
name: Deploy to staging
runs-on: ubuntu-latest
environment:
name: staging
url: https://docs-staging.pupil-labs.com
needs: build
steps:
- uses: actions/checkout@v3
- name: Download generated website dist dir
uses: actions/download-artifact@v2
with:
name: vuepress-dist
path: src/.vuepress/dist
- name: Rsync action - Deploy to staging
uses: burnett01/[email protected]
with:
switches: -hrvz --delete --exclude=".htaccess"
path: src/.vuepress/dist/
remote_path: ${{ secrets.REMOTE_PATH }}
remote_host: ${{ secrets.REMOTE_HOST}}
remote_user: ${{ secrets.REMOTE_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}