Skip to content

Commit c54aa20

Browse files
committed
Add build job to update scaladocs
1 parent ff33b77 commit c54aa20

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,51 @@ jobs:
8080
tag="${GITHUB_REF#refs/tags/}"
8181
args=$(printf -- "-a %q " {xtract-core,testing,macros}/target/*/*.jar)
8282
hub release create $args -m "Release $tag" $tag
83+
publish-docs:
84+
if: startsWith(github.ref, 'refs/tags')
85+
runs-on: ubuntu-20.04
86+
steps:
87+
- name: Checkout code
88+
uses: actions/checkout@v2
89+
with:
90+
path: code
91+
- name: Checkout pages
92+
uses: actions/checkout@v2
93+
with:
94+
ref: refs/heads/gh-pages
95+
path: pages
96+
fetch-depth: 0
97+
- uses: actions/cache@v2
98+
with:
99+
path: |
100+
~/.ivy2/cache
101+
~/.sbt
102+
~/.coursier
103+
target/
104+
*/target/
105+
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/*.scala') }}
106+
restore-keys: |
107+
${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-
108+
${{ runner.os }}-sbt-
109+
- name: Build docs
110+
run: sbt "xtract / doc" "xtractMacros / doc" "xtractTesting / doc"
111+
working-directory: ./code
112+
- name: Copy docs
113+
run: |
114+
version="${GITHUB_REF#refs/*/}"
115+
mkdir -p pages/{core,macros,testing}/api/$version
116+
cp -rf xtract-core/target/jvm-$SCALA_VERS/api/* pages/core/api/$version/
117+
cp -rf macros/target/jvm-$SCALA_VERS/api/* pages/macros/api/$version/
118+
cp -rf testing/target/jvm-$SCALA_VERS/api/* pages/testing/api/$version/
119+
env:
120+
SCALA_VERS: 2.13
121+
- name: Commit changes
122+
run: |
123+
git config --local user.email "github@lucidchart.com"
124+
git config --local user.name "github-actions [bot]"
125+
git add .
126+
git commit -m "Add documentation for ${{ github.ref }}"
127+
working-directory: ./pages
128+
- name: Push changes
129+
run: git push origin HEAD:refs/heads/gh-pages
130+
working-directory: ./pages

0 commit comments

Comments
 (0)