[ci] publish doesn't depend on build anymore #5
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: Build and deploy docs | |
on: | |
push: | |
branches: | |
- master | |
- gh-pages | |
- release/* | |
#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 | |
if: github.ref != 'refs/heads/gh-pages' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- 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-deploy: false | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: ${{ github.event.pull_request.title }} | |
enable-commit-comment: ${{ github.event_name != 'schedule' }} | |
alias: preview-${{ github.event.number }} | |
fails-without-credentials: true | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 5 | |
- name: Deploy versioned docs | |
# TODO support publishing non-dev versions | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: | | |
make deploy RELEASE=dev ALIAS=master | |
git push origin gh-pages | |
- 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 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/gh-pages' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy to Netlify | |
uses: nwtgck/actions-netlify@v2 | |
with: | |
publish-dir: ./ | |
production-deploy: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: ${{ github.event.pull_request.title }} | |
enable-commit-comment: ${{ github.event_name != 'schedule' }} | |
fails-without-credentials: true | |
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 |