Skip to content

Commit 36718ca

Browse files
Update Workflow
1 parent 2741721 commit 36718ca

File tree

1 file changed

+47
-10
lines changed

1 file changed

+47
-10
lines changed

.github/workflows/website.yml

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
11
name: Deploy LiaScript-Web-Site to Pages
22

33
on:
4-
# Runs on pushes targeting the default branch
54
push:
65
branches:
76
- master
8-
9-
# Allows you to run this workflow manually from the Actions tab
107
workflow_dispatch:
118

12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
139
permissions:
1410
contents: write
1511
pages: write
1612
id-token: write
1713

18-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2014
concurrency:
2115
group: "pages"
2216
cancel-in-progress: false
2317

24-
# Default to bash
2518
defaults:
2619
run:
2720
shell: bash
2821

2922
jobs:
30-
# Build job
23+
check_liascript_changes:
24+
runs-on: ubuntu-latest
25+
outputs:
26+
should_build: ${{ steps.check.outputs.should_build }}
27+
steps:
28+
- name: Check LiaScript repository
29+
id: check
30+
run: |
31+
LAST_COMMIT=$(curl -s https://api.github.com/repos/LiaScript/LiaScript/commits/development | jq -r '.sha')
32+
echo "Last commit: $LAST_COMMIT"
33+
echo "should_build=$([ "$LAST_COMMIT" != "$(cat .liascript_last_commit 2>/dev/null)" ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
34+
echo $LAST_COMMIT > .liascript_last_commit
35+
3136
hugo:
3237
runs-on: ubuntu-latest
3338
env:
@@ -68,8 +73,10 @@ jobs:
6873
with:
6974
name: public
7075
path: ./public
71-
76+
7277
liascript:
78+
needs: check_liascript_changes
79+
if: needs.check_liascript_changes.outputs.should_build == 'true'
7380
runs-on: ubuntu-latest
7481
steps:
7582
- name: Set ELM_HOME
@@ -102,7 +109,15 @@ jobs:
102109
name: course
103110
path: ./LiaScript/dist
104111

112+
- name: Cache LiaScript artifact
113+
uses: actions/cache@v2
114+
with:
115+
path: ./LiaScript/dist
116+
key: ${{ runner.os }}-liascript-${{ github.sha }}
117+
105118
liascript-nightly:
119+
needs: check_liascript_changes
120+
if: needs.check_liascript_changes.outputs.should_build == 'true'
106121
runs-on: ubuntu-latest
107122
steps:
108123
- name: Set ELM_HOME
@@ -136,14 +151,20 @@ jobs:
136151
name: nightly
137152
path: ./LiaScript/dist
138153

139-
# Deployment job
154+
- name: Cache LiaScript-nightly artifact
155+
uses: actions/cache@v2
156+
with:
157+
path: ./LiaScript/dist
158+
key: ${{ runner.os }}-liascript-nightly-${{ github.sha }}
159+
140160
deploy:
141161
environment:
142162
name: github-pages
143163
url: ${{ steps.deployment.outputs.page_url }}
144164
runs-on: ubuntu-latest
145165
needs:
146166
- hugo
167+
- check_liascript_changes
147168
- liascript
148169
- liascript-nightly
149170
steps:
@@ -191,6 +212,22 @@ jobs:
191212
tar -xvf public/nightly/artifact.tar -C public/nightly
192213
rm public/nightly/artifact.tar
193214
215+
- name: Download or use cached LiaScript artifact
216+
uses: actions/cache@v2
217+
with:
218+
path: ./public/course
219+
key: ${{ runner.os }}-liascript-${{ github.sha }}
220+
restore-keys: |
221+
${{ runner.os }}-liascript-
222+
223+
- name: Download or use cached LiaScript-nightly artifact
224+
uses: actions/cache@v2
225+
with:
226+
path: ./public/nightly
227+
key: ${{ runner.os }}-liascript-nightly-${{ github.sha }}
228+
restore-keys: |
229+
${{ runner.os }}-liascript-nightly-
230+
194231
- name: Deploy to GitHub Pages
195232
uses: peaceiris/actions-gh-pages@v3
196233
with:

0 commit comments

Comments
 (0)