Merge pull request #8 from cjs835/master #15
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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build_css: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source Git branch | |
uses: actions/checkout@v2 | |
with: | |
ref: master | |
fetch-depth: 10 | |
submodules: true | |
- name: Make destination directory for compiled CSS | |
run: mkdir -vp /tmp/css | |
- name: Compile CSS from SCSS files | |
uses: gha-utilities/[email protected] | |
with: | |
source: style.sass | |
destination: /tmp/css/style.css | |
- name: Checkout destination Git branch | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
fetch-depth: 1 | |
- name: Reset gh-pages branch to master | |
run: | | |
git reset --hard origin/master | |
git config --local user.email '[email protected]' | |
git config --local user.name 'GitHub Action' | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
force: true | |
- name: Move compiled CSS to path within pr-pages branch | |
run: mv /tmp/css/style.css style.css | |
- name: Add and Commit changes to gh-pages branch | |
run: | | |
git config --local user.email '[email protected]' | |
git config --local user.name 'GitHub Action' | |
cat >.gitignore<<EOF | |
*.css | |
*.css.map | |
!style.css | |
EOF | |
git add . | |
git commit -m 'Updates compiled CSS files' | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages |