summaryrefslogtreecommitdiff
path: root/.github/workflows/update-site.yml
blob: e43457da823c318efa9353d2376ff3b3d0c95d74 (plain)
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
name: update site

on:
  push:
    branches:
      - 'master' 
    paths:
      - '**/README.md'

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Generate md
      run: ./scripts/update_site.sh

    - name: Push to gh-pages branch
      run: |
        git config --global user.name 'GitHub Action'
        git config --global user.email 'action@github.com'
        git add ./_widgets
        git add ./assets/img/widgets
        git stash
        git fetch
        echo "git checkout gh-pages"
        git checkout gh-pages
        rm -rf ./_widgets
        rm -rf ./assets/img/widgets
        ls -alF
        echo "git stash pop"
        git checkout stash -- ./_widgets
        git checkout stash -- ./assets/img/widgets
        git add ./_widgets
        git add ./assets/img/widgets
        git commit -m "update from master"
        git push origin gh-pages