-
Notifications
You must be signed in to change notification settings - Fork 226
66 lines (56 loc) · 1.96 KB
/
build.yml
File metadata and controls
66 lines (56 loc) · 1.96 KB
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
name: Build Project
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Fetch Data
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Aggregate Blocks
shell: bash
run: |
set -x
npm install # install packages
NODE_OUTPUT=`node .github/scripts/agg-blocks.mjs 2>&1`
if [[ ! $NODE_OUTPUT ]];then
exit 0
fi
NODE_OUTPUT="<pre>${NODE_OUTPUT//$'\n'/<br />}</pre>"
PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
if [[ ! $PR_NUMBER ]]; then
exit 0
fi
jq -n --arg body "$(echo $NODE_OUTPUT)" '{ body: $body }' |\
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/commits/$GITHUB_SHA/comments"
- name: Commit files
run: |
NEWART=`git diff HEAD@{1} --stat -- ./src/blocks.js | wc -l`
if [[ $NEWART -le 0 ]];then
echo "no changes to src/blocks.js"
exit 0
fi
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Updated blocks.js card JSON" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Publish
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: src
CLEAN: true