Skip to content

Add workflow to publish previews and prod for master #1

Add workflow to publish previews and prod for master

Add workflow to publish previews and prod for master #1

Workflow file for this run

name: Build and deploy docs
on:
push:
branches: ["master"]
#schedule:
#- cron: '*/15 * * * *'
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false
concurrency:
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build docs
run: make build
- name: Deploy preview to Netlify
uses: nwtgck/actions-netlify@v2
if: github.event_name == 'pull_request'
with:
publish-dir: ./site
production-branch: gh-pages
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: ${{ github.event.pull_request.title }}
enable-commit-comment: ${{ github.event_name != 'schedule' }}
alias: preview-${{ github.event.number }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5
- name: Setup tmate session for debug
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 45
with:
limit-access-to-actor: true
publish:
runs-on: ubuntu-latest
needs: [build]
# TODO support publishing from release/* branches
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Build versioned docs
# TODO support publishing non-dev versions
run: make deploy RELEASE=dev ALIAS=master
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v2
with:
publish-dir: ./
production-branch: gh-pages
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: ${{ github.event.pull_request.title }}
enable-commit-comment: ${{ github.event_name != 'schedule' }}
alias: preview-${{ github.event.number }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5
- name: Setup tmate session for debug
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 45
with:
limit-access-to-actor: true