[DOCS] deploying custom elements #514
Workflow file for this run
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: "Docs Check" | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['main', 'dev-*'] | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
tests: | |
name: "Docs" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e .[docs] | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
- name: build docs | |
run: | | |
make docs | |
- name: save docs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs-html | |
path: docs/_site | |
# push to netlify ------------------------------------------------------- | |
# set release name ---- | |
- name: Configure pull release name | |
if: ${{github.event_name == 'pull_request'}} | |
run: | | |
echo "RELEASE_NAME=pr-${PR_NUMBER}" >> $GITHUB_ENV | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
- name: Configure branch release name | |
if: ${{github.event_name != 'pull_request'}} | |
run: | | |
# use branch name, but replace slashes. E.g. feat/a -> feat-a | |
echo "RELEASE_NAME=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV | |
# deploy ---- | |
- name: Create Github Deployment | |
uses: bobheadxi/deployments@v0.4.3 | |
id: deployment | |
with: | |
step: start | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: ${{ env.RELEASE_NAME }} | |
ref: ${{ github.head_ref }} | |
transient: true | |
logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' | |
- name: Netlify docs preview | |
run: | | |
npm install -g netlify-cli | |
# push main branch to production, others to preview -- | |
if [ "${ALIAS}" == "main" ]; then | |
netlify deploy --dir=docs/_site --alias="main" | |
else | |
netlify deploy --dir=docs/_site --alias="${ALIAS}" | |
fi | |
env: | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
ALIAS: ${{ steps.deployment.outputs.env }} | |
- name: Update Github Deployment | |
uses: bobheadxi/deployments@v1 | |
if: always() | |
with: | |
step: finish | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} | |
env: ${{ steps.deployment.outputs.env }}j | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
env_url: 'https://${{ steps.deployment.outputs.env }}--relaxed-mooncake-704252.netlify.app' | |
logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' | |
- name: publish dev docs | |
if: github.ref_name == 'main' && github.ref_type == 'branch' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_site | |
publish_branch: gh-pages | |
destination_dir: main | |
- name: publish stable docs | |
if: github.ref_type == 'tag' && startswith(github.ref, 'refs/tags/v') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_site | |
publish_branch: gh-pages | |
destination_dir: ${{ github.ref_name }} | |
- name: create symlink stable to new version | |
if: github.ref_type == 'tag' && startswith(github.ref, 'refs/tags/v') | |
run: | | |
rm stable | |
ln -s ${{ github.ref_name }} stable | |
ls -la |