-
Notifications
You must be signed in to change notification settings - Fork 35
154 lines (125 loc) · 5.21 KB
/
main.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Main GH Actions workflow
on:
push:
branches:
- main
schedule:
- cron: "06 2 * * *"
workflow_dispatch:
inputs:
branch:
description: 'Documentation page deployment source branch'
required: true
default: main
# Not yet heavily tested - therefore disabled
#
# Allow to stop obsolete workflows
#concurrency:
# group: ci-buildtrain-${{ github.ref }}-1
# cancel-in-progress: true
# Required for the deployment to be able to upload to the "gh-pages" branch
# (since the repo settings for default actions permission defaults to read only)
permissions:
contents: write
env:
CHANGELOG_LMS8_SRC: https://raw.githubusercontent.com/LMS-Community/slimserver/HEAD/Changelog8.html
CHANGELOG_LMS8_TARGET: docs/getting-started/changelog-lms8.md
CHANGELOG_LMS9_SRC: https://raw.githubusercontent.com/LMS-Community/slimserver/HEAD/Changelog9.html
CHANGELOG_LMS9_TARGET: docs/getting-started/changelog-lms9.md
PLUGIN_TARGET: docs/plugins/directory.md
SQUEEZELITE_MANPAGE_SRC: https://raw.githubusercontent.com/ralph-irving/squeezelite/master/doc/squeezelite.1
SQUEEZELITE_MANPAGE_TARGET: docs/players-and-controllers/squeezelite-manpage.md
STRINGS_COVERAGE_JSON: docs/contributing/strings-coverage.json
STATS_JSON: docs/analytics/stats.json
jobs:
get-external-changelog:
name: Import external data sources
runs-on: ubuntu-24.04
steps:
- name: Install Go to satisfy dependencies
uses: actions/setup-go@v5
with:
go-version: '>=1.23.0'
- name: Install dependencies
run: |
go install github.com/suntong/html2md@v1.5.0
sudo apt-get update
sudo apt-get install -y libjson-perl libwww-perl libxml-simple-perl libyaml-perl python3-babel
- name: Checkout code
uses: actions/checkout@v4
- name: Get changelog and convert to markdown
run: |
export PATH=${PATH}:`go env GOPATH`/bin
html2md -i $CHANGELOG_LMS8_SRC > $CHANGELOG_LMS8_TARGET
sed -Ei 's/http:\/\/raw.githubusercontent.com.*?#v([1-9]+)\.([0-9]+)\.([0-9]+)\)/#version-\1\2\3)/' $CHANGELOG_LMS8_TARGET
sed -Ei 's/^\s\s*/\t/g' $CHANGELOG_LMS8_TARGET
html2md -i $CHANGELOG_LMS9_SRC > $CHANGELOG_LMS9_TARGET
sed -Ei 's/http:\/\/raw.githubusercontent.com.*?#v([1-9]+)\.([0-9]+)\.([0-9]+)\)/#version-\1\2\3)/' $CHANGELOG_LMS9_TARGET
sed -Ei 's/http:\/\/raw.githubusercontent.com\/Changelog8.html/changelog-lms8.md/' $CHANGELOG_LMS9_TARGET
sed -Ei 's/^\s\s*/\t/g' $CHANGELOG_LMS9_TARGET
- name: Get squeezelite manpage and convert to markdown
run: |
: # TODO not the most elegant way of running a Perl script from Github
: # We download this specific commit as this version is verified
curl -O https://raw.githubusercontent.com/mle86/man-to-md/f484095dbbe741469ff5180f20d829172c2ff571/man-to-md.pl
echo -e "---\nlayout: default\ntitle: squeezelite(1) manpage\nhide:\n - toc\n---\n" >$SQUEEZELITE_MANPAGE_TARGET
perl man-to-md.pl <(curl -s $SQUEEZELITE_MANPAGE_SRC) >>$SQUEEZELITE_MANPAGE_TARGET
rm man-to-md.pl
- name: Get release downloads and embed in Getting Started document
run: |
tools/build-server-downloads-page.pl
- name: Get plugin repository and convert to markdown
run: |
tools/build-plugin-repository.pl > $PLUGIN_TARGET
- name: Get analytics data
run: |
tools/get-analytics-data.pl > $STATS_JSON
- name: Check out LMS code for strings coverage
uses: actions/checkout@v4
with:
repository: LMS-Community/slimserver
path: slimserver
- name: Get translation coverage of slimserver strings.txt
run: |
tools/get-strings-coverage.py <(find slimserver -name strings.txt -exec cat {} \;) >$STRINGS_COVERAGE_JSON
rm -rf slimserver
- name: Commit changes
if: ${{ !env.ACT }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add --all
if [ -n "$(git status --porcelain)" ]; then
git commit -m "Update external data sources"
git push
else
echo "No changes to commit";
fi
deploy-mkdocs:
if: ${{ always() }}
name: Build website and publish to gh-pages branch
needs: get-external-changelog
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: |
pip install mkdocs-material
pip install mkdocs-macros-plugin
pip install mkdocs-charts-plugin
- run: mkdocs gh-deploy --force