-
Notifications
You must be signed in to change notification settings - Fork 6
74 lines (62 loc) · 2.01 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# 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