-
Notifications
You must be signed in to change notification settings - Fork 11
101 lines (86 loc) · 2.83 KB
/
wc_publishSite.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
name: Reusable - Publish documentation
on:
workflow_call:
inputs:
publish:
required: true
type: string
default: 'yes'
jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
uses: JoshuaTheMiller/[email protected]
with:
filter: '[?isRelease==`release`]'
# DOCUMENTATION
scaladoc_api:
needs: ["matrix_prep"]
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# SETUP & CACHE
- uses: coursier/[email protected]
with:
jvm: adopt:8
apps: sbt scala scalafmt # https://github.com/coursier/apps
- uses: coursier/cache-action@v6
with:
extraKey: "${{ matrix.spark }}"
# BUILD SCALADOCS (API)
- name: Build the scaladocs 💻
run: sbt -DsparkVersion=${{ matrix.spark }} +core/doc
shell: bash
# UPLOAD DOCS
- name: Prepare scaladocs
if: inputs.publish == 'yes'
id: prepare_scaladocs
run: |
SCALA_VERSIONS=$(ls -d core/target/scala-*/)
for scala_path in ${SCALA_VERSIONS}; do
scala_version=$(basename ${scala_path})
mkdir --parents --verbose spark-${{ matrix.spark }}/${scala_version}/
mv ${scala_path}/api/* spark-${{ matrix.spark }}/${scala_version}/
done
shell: bash
- name: Upload docs ⬆️
if: steps.prepare_scaladocs.conclusion == 'success'
uses: actions/upload-artifact@v4
with:
name: "spark-${{ matrix.spark }}"
path: "spark-${{ matrix.spark }}"
if-no-files-found: error
# CLEAN PROJECT BEFORE CACHE
- name: Cleaning before cache 🚯
if: ${{ always() }}
uses: ./.github/actions/clean_cache
# PUBLISH DOC JOB
generate_publish_mdoc:
needs: [ "scaladoc_api" ]
if: inputs.publish == 'yes'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# BUILD MDOC, sbt should take the latest version
- name: Build the microsite 💻
run: sbt +docs/mdoc
shell: bash
# DOWNLOAD DOCS, this will download all the artifacts because no name provided
- name: Download docs ⬇️
uses: actions/download-artifact@v4
with:
path: "docs/target/mdoc/docs/api/"
# DEPLOY TO GITHUB PAGES
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/target/mdoc # The folder the action should deploy.
token: ${{ secrets.GITHUB_TOKEN }}