-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.sh
40 lines (31 loc) · 841 Bytes
/
generate.sh
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
#!/bin/bash
MYSHELL=$(ps -hp $$ | awk '{print $5}')
if [ "$(basename "$MYSHELL")" != "bash" ]
then
echo "script is written for bash only, detected $MYSHELL"
exit 1
fi
set -e
set -o pipefail
[ -z "$1" ] && echo "Usage: $0 <folder>" && exit 1
[ ! -d "$1" ] && echo "Error: $1 is not a folder" && exit 1
[ ! -f "$1/.update_devcontainer.sh" ] && echo "Error: $1/.update_devcontainer.sh does not exist" && exit 1
export FOLDER=$1
shift
sh "$FOLDER/.update_devcontainer.sh" "$@"
cat >".github/workflows/$FOLDER.yml" <<EOF
name: $FOLDER
on:
push:
paths:
- $FOLDER/language.yaml
- .github/workflows/$FOLDER.yml
jobs:
BuildDevcontainer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test Devcontainer
run: bash generate.sh $FOLDER --test
EOF