Git Product home page Git Product logo

hugo-remote's Introduction

GitHub Action to build and deploy a Hugo site to a remote repository ๐Ÿš€

If you've ever wanted to keep your Hugo site source repository private, but deploy the site to your public GitHub Pages repository, you're in the right place.

This action cleans and rebuilds your Hugo site, and pushes the new build to a remote repository you define.

It always uses the latest extended version from Hugo releases. The extended version enables the processing of SCSS and Sass files to CSS.

Your site will build in the DEST directory you specify (Hugo's usual default is public). The contents of this directory will then be pushed to master of your remote public repository.

Use this in your workflow

Here's how to use this action in your workflow file.

1. Add a Personal Access Token as a Secret called TOKEN in your repository

See Creating a token to set up a Personal Access Token. See Creating and storing encrypted secrets for instructions to add this to your repository.

When you're finished, your repository's Secrets tab will look like this:

Secrets tab showing saved TOKEN encrypted variable

2. Set your environment variables and add this action in a workflow

This action expects variables for:

  • REMOTE, your remote repository in the format <username>/<repository name>.git,
  • DEST, the name of the destination directory you would like the site to build to,
  • TOKEN, in the form ${{ secrets.TOKEN }} assuming TOKEN is the name you've used.

Here is an example workflow file that uses this action on any push event to the master branch:

name: hugo-remote

on:
  push:
    branches:
      - master

env:
  REMOTE: username/username.github.io.git
  DEST: public
  TOKEN: ${{ secrets.TOKEN }}

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - name: ๐Ÿ›Ž Check out master
        uses: actions/checkout@master
        with:
          fetch-depth: 1
      - name: ๐Ÿš€ Build and deploy
        uses: victoriadrake/hugo-remote@master

If your chosen Hugo theme is a submodule, you may need to get it explicitly in your workflow. See #1 for more information and an example.

See full instructions for Configuring and managing workflows.

Use the workflow YAML file directly

If you prefer to place this action's YAML file in your repository directly, simply copy the included hugo-remote.yml into your repository's .github/workflows/ directory.

For help editing the YAML file, see Workflow syntax for GitHub Actions.

hugo-remote's People

Contributors

victoriadrake 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.