-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (81 loc) · 2.89 KB
/
ci.yml
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
76
77
78
79
80
81
82
83
84
name: ci
on:
push:
branches:
- "**"
defaults:
run:
shell: bash
concurrency: ci-${{ github.ref }}-${{ github.workflow }}
jobs:
test:
uses: ./.github/workflows/tests.yml
permissions:
actions: read
id-token: write
contents: read
deployments: write
verify:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: install shellcheck
run: |
target_shellcheck_version="0.9.0"
shellcheck_sha="157fd8b2c18a257f3876e23015580ea63d27b12c4f13f87d625a180e8ca042e7501271d15edeb36e7b5780da73815b45386a33e063ab1c891d838f35c778a8ac"
filename="shellcheck-v$target_shellcheck_version"
file_path="/tmp/$filename.tar.xz"
mkdir -p "/opt/$filename"
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/v$target_shellcheck_version/$filename.linux.x86_64.tar.xz" -o "$file_path"
echo "${shellcheck_sha} $file_path" | sha512sum -c -
tar -xJf "$file_path" -C "/opt/$filename" --strip-components=1 --no-same-owner
export "PATH=/opt/$filename:$PATH"
current_shellcheck_version="$(shellcheck --version | sed -n "s/^version: \(.*\)$/\1/p")"
if [ "$current_shellcheck_version" != "$target_shellcheck_version" ]; then
exit 1
fi
- name: run shellcheck
run: |
has_failed="false"
while read -r -d '' file; do
if ! current_result="$(shellcheck --severity=warning --color=never "$file")"; then
has_failed="true"
echo "--- $file ---"
echo "$current_result"
echo ""
echo ""
fi
done < <(find "." ! -path "*/.git/*" -wholename "*.sh" -print0)
if [ "$has_failed" != "false" ]; then
exit 1
fi
- name: verify docs are up-to-date
run: |
python -m pip install "pyyaml==6.0.1"
diff <(python generate-docs.py README.md) README.md || { cat <<EOF
The documentation is not up-to-date. Run the following command to update:
printf "%s\n" "\$(python generate-docs.py README.md)" > README.md
EOF
exit 1
}
conditional-release:
needs:
- verify
- test
runs-on: ubuntu-22.04
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
- name: "install npm dependencies"
run: npm ci
- name: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run semantic-release