generated from pffy/code-gs
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (62 loc) · 1.88 KB
/
concat-gs-files.yaml
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
75
## git: https://github.com/pffy/code-gs
## lic: https://unlicense.org/
name: concat-gs-files
on:
push:
paths:
- 'src/*.gs'
branches:
- 'main'
jobs:
build_dist:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: concat gs files to code-gs
run: |
ls
pwd
## get concat helper text files
git clone https://github.com/pffy/nip
## get the file location for horizontal rule
HR=$PWD/nip/js/hr80.js
echo $HR
## from the repo root, list gs files in 'src' with commas
FF=$(ls -1 src/*.gs | tr "\n" ",")
echo $FF
## based on solution found here:
## https://stackoverflow.com/a/27658733
## removes last comma
FF=${FF::-1}
echo $FF
## based on this solutions:
## https://stackoverflow.com/a/13210909
## replace the commas with file name of HR80
FF=${FF//,/ $HR }
echo $FF
OUTFILE=code.gs
## build a new outfile
rm -f $OUTFILE
echo "/* $OUTFILE generated by concat-gs-files workflow: gh/pffy/code-gs */" >> $OUTFILE
echo "" >> $OUTFILE
cat $FF >> $OUTFILE
pwd
## finish, move outfile to `dist` folder
rm -rf dist
mkdir -p dist
mv code.gs ./dist
## cleanup
rm -rf nip
- name: show a tree
run: |
tree .
- name: setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: commit
run: |
git add .
git commit -m "generated by concat-gs-files workflow"
git push origin main