Skip to content

Commit

Permalink
Add workflow to publish previews and prod for master
Browse files Browse the repository at this point in the history
  • Loading branch information
Frostman committed Oct 30, 2023
1 parent 9fdb249 commit 528f518
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Hedgehog Open Network Fabric Documentation

[![Netlify Status](https://api.netlify.com/api/v1/badges/76ba2fb4-b33a-4f0f-b81d-c61e3b603bc9/deploy-status)](https://app.netlify.com/sites/hedgehog-docs/deploys)

Published to [https://docs.githedgehog.com](https://docs.githedgehog.com).

0 comments on commit 528f518

Please sign in to comment.