Skip to content

Instantly share code, notes, and snippets.

@mircohacker
Created April 30, 2020 08:13
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mircohacker/ae72325bd362a3a98a998655bb765c1b to your computer and use it in GitHub Desktop.
Save mircohacker/ae72325bd362a3a98a998655bb765c1b to your computer and use it in GitHub Desktop.
Push to Github Pages with Github Actions
name: Build and Deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
- name: Install and Build 🔧
run: |
echo 'TODO build here'
- name: Deploy 🚀
env:
ACCESS_TOKEN: ${{ secrets.TOKEN }} # This token has to be generated as shown in https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line
run: |
set -ex
# use the generated token to autheticate the action
git remote set-url origin https://mircohaug:${ACCESS_TOKEN}@github.com/mircohaug/reddit-compiler.git
# split of the subtree at frontend/dist (or wherever your frontend is located) and force push it to the gh-pages branch
git push origin `git subtree split --prefix frontend/dist master`:gh-pages --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment