Skip to content

actions-mn/deploy-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deploy-pages

GitHub tag (latest by date) GitHub actions

Meta action to deploy GitHub Pages with PR deployment ability in one step

If you don't need PR deployment use other actions like actions/deploy-pages@v1

Table of contents generated with markdown-toc

Prerequisites

  1. Make sure that GitHub Pages enabled in settings

  2. Site artifact must be built before. actions-mn/build-and-publish@v1 can be used for this

  3. Define all required permissions in workflow like this

    permissions:
      pull-requests: write
      contents: read
      pages: write
  4. Use PAT token that has permissions for pull request comments and git push

Scenario

Typically, you can utilize it by providing only one parameter token

...
+ uses: actions-mn/deploy-pages@main
  with:
    token: ${{ secrets.GITHUB_TOKEN }}

Important note. Make sure you pass token, that is allowed to do GitHub Pages deployment

Except token, you also can pass:

  • artifact-name - the default value is the same as actions-mn/build-and-publish
  • source-dir - source directory where
  • preview-branch - GitHub Pages branch
  • umbrella-dir - directory in the GitHub Pages branch where PR deployments are stored

Complete example

name: github-pages-deployment

on:
  push:
    branches:
    - main
  pull_request:
    types:
    - opened
    - reopened
    - synchronize
    - closed

permissions:
  pull-requests: write
  contents: read
  pages: write

jobs:
  build:
    if: ${{ github.event.action != 'closed' }}
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Setup Metanorma
      uses: actions-mn/setup@v1

    - name: Cache Metanorma assets
      uses: actions-mn/cache@v1

    - name: Metanorma generate site
      uses: actions-mn/build-and-publish@main
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        destination: artifact
        agree-to-terms: true

  deploy-gh-pages:
    runs-on: ubuntu-latest
    needs: build
    steps:
    - name: Deploy to GitHub Pages
      uses: actions-mn/deploy-pages@main
      with:
        token: ${{ secrets.PAT_TOKEN }}

  clean-gh-pages:
    if: ${{ github.event.action == 'closed' }}
    runs-on: ubuntu-latest
    steps:
    - name: Deploy to GitHub Pages
      uses: actions-mn/deploy-pages@main
      with:
        token: ${{ secrets.PAT_TOKEN }}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published