GithubHelp home page GithubHelp logo

action-publish-gh-pages's Introduction

MetaMask/action-publish-gh-pages

This repository can be used on its own but is better used along with: https://github.com/MetaMask/action-publish-release

Add the following Workflow File to your repository in the path .github/workflows/publish-gh-pages.yml

Usage

This action makes a few assumptions:

  • The package using this action is using yarn
  • The package requires some build command to be run before being published
  • No commands other than the build command are required before publishing
  • The GitHub Pages branch name is gh-pages

Every input has useful defaults, and can freely be set to whatever matches your preferences. The notable exception is destination-directory, which defaults to '.'. If this default is left in place, the contents of the gh-pages branch will be overwritten with the contents of source-directory. If destination-directory is set to anything other than '.', the contents of source-directory will be committed to the specified destination directory without affecting any content outside of that directory.

Example Workflow

name: Publish Github Pages

on:
  pull_request:
    types: [closed]

jobs:
  publish-gh-pages:
    permissions:
      contents: write
    # The second argument to startsWith() must match the release-branch-prefix
    # input to this Action. Here, we use the default, "release/".
    if: |
      github.event.pull_request.merged == true &&
      startsWith(github.event.pull_request.head.ref, 'release/')
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Get Node.js version
        id: nvm
        run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
      - uses: actions/setup-node@v2
        with:
          node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
      - uses: MetaMask/action-publish-gh-pages@v2
        with:
          source-directory: public
          # This will commit the contents of "public" in the source branch to
          # a directory named "latest" on the gh-pages branch.
          # If destination-directory were omitted, all existing content of the
          # gh-pages branch would be deleted and the the contents of "public"
          # would be committed to the root directory.
          destination-directory: latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

action-publish-gh-pages's People

Contributors

github-actions[bot] avatar rickycodes avatar shanejonas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.