Skip to content

Commit b332d62

Browse files
committed
Create a workflow pushing language reference documentation to target repo
1 parent 31f871c commit b332d62

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: language-reference-documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- 'language-reference-stable'
7+
pull_request:
8+
branches:
9+
- 'language-reference-stable'
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Get current date
16+
id: date
17+
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
18+
19+
- name: Git Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
path: 'dotty'
23+
ref: 'language-reference-stable'
24+
ssh-key: ${{ secrets.DOCS_KEY }}
25+
26+
- name: Cache Coursier
27+
uses: actions/cache@v1
28+
with:
29+
path: ~/.cache/coursier
30+
key: sbt-coursier-cache
31+
32+
- name: Cache SBT
33+
uses: actions/cache@v1
34+
with:
35+
path: ~/.sbt
36+
key: sbt-${{ hashFiles('**/build.sbt') }}
37+
38+
- name: Set up JDK 11
39+
uses: actions/setup-java@v1
40+
with:
41+
java-version: 11
42+
43+
- name: Generate reference documentation and test links
44+
run: |
45+
./dotty/project/scripts/sbt scaladoc/generateReferenceDocumentation --no-regenerate-expected-links
46+
./dotty/project/scripts/docsLinksStability ./dotty/scaladoc/output/reference ./dotty/project/scripts/expected-links/reference-expected-links.txt
47+
48+
- name: Push changes to scala3-reference-docs
49+
if: github.event_name == 'push'
50+
uses: actions/checkout@v3
51+
with:
52+
repository: lampepfl/scala3-reference-docs
53+
fetch-depth: 0
54+
submodules: true
55+
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
56+
path: 'scala3-reference-docs'
57+
58+
- if: github.event_name == 'push'
59+
run: |
60+
\cp -a dotty/scaladoc/output/reference/. scala3-reference-docs/
61+
cd scala3-reference-docs
62+
git config user.name gh-actions
63+
git config user.email [email protected]
64+
git add .
65+
git commit -m "UPDATE ${{ steps.date.outputs.date }}"
66+
git push
67+
cd ..
68+
69+
- name: Merge changes to main
70+
if: github.event_name == 'push'
71+
run: |
72+
cd dotty
73+
git fetch origin main:main
74+
git checkout main
75+
git merge language-reference-stable
76+
cd ..
77+
78+
- name: Create pull reuqest with backport to main
79+
if: github.event_name == 'push'
80+
uses: peter-evans/create-pull-request@v4
81+
with:
82+
path: dotty
83+
branch: language-reference-backport
84+
labels: area:documentation
85+

0 commit comments

Comments
 (0)