-
Notifications
You must be signed in to change notification settings - Fork 53
62 lines (56 loc) · 1.9 KB
/
update-docs.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
# Update the docs using the rewrite-recipe-markdown-generator
name: Update docs
on:
workflow_dispatch:
schedule:
- cron: "0 9 * * *"
concurrency:
group: "update-docs"
cancel-in-progress: true
jobs:
build:
name: Update docs
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
# Shared setup
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- uses: gradle/actions/setup-gradle@v4
# Run generator
- uses: actions/checkout@v4
with:
fetch-depth: 0
repository: 'openrewrite/rewrite-recipe-markdown-generator'
path: 'rewrite-recipe-markdown-generator'
- name: Generate Markdown
run: ./gradlew ${{ env.GRADLE_SWITCHES }} latestVersionsMarkdown
working-directory: rewrite-recipe-markdown-generator
# Move generated markdown to docs/
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: 'rewrite-docs'
- name: Move generated markdown to docs/
run: |
mv rewrite-recipe-markdown-generator/build/docs/*.md rewrite-docs/docs/reference/
mv rewrite-recipe-markdown-generator/build/docs/*.js rewrite-docs/src/plugins/
# Commit and push changes
- name: configure-git-user
working-directory: rewrite-docs
run: |
git config user.email "[email protected]"
git config user.name "team-moderne[bot]"
- name: Commit and push
working-directory: rewrite-docs
run: |
export MSG="[Auto] Latest versions as of $(date +'%Y-%m-%d %H:%M')"
export DOC=docs/reference/latest-versions-of-every-openrewrite-module.md
export JS=src/plugins/latest-versions.js
if ! git diff-index --quiet HEAD ${DOC} ${JS};
then
git commit --message "${MSG}" ${DOC} ${JS};
git push origin master;
fi