Created
April 30, 2020 08:13
-
-
Save mircohacker/ae72325bd362a3a98a998655bb765c1b to your computer and use it in GitHub Desktop.
Push to Github Pages with Github Actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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