Skip to content

Workflow to generate and push language reference documentation #14852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/language-reference.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: language-reference-documentation

on:
push:
branches:
- 'language-reference-stable'
pull_request:
branches:
- 'language-reference-stable'
workflow_dispatch

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Git Checkout
uses: actions/checkout@v3
with:
path: 'dotty'
ref: 'language-reference-stable'
ssh-key: ${{ secrets.DOCS_KEY }}

- name: Cache Coursier
uses: actions/cache@v1
with:
path: ~/.cache/coursier
key: sbt-coursier-cache

- name: Cache SBT
uses: actions/cache@v1
with:
path: ~/.sbt
key: sbt-${{ hashFiles('**/build.sbt') }}
Comment on lines +27 to +37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think these could and should be replaced with https://github.com/coursier/cache-action?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is copy-paste from our CI. Perhaps we can make it better


- name: Set up JDK 11
uses: actions/setup-java@v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest release is currently 3.x, should we use a more recent one?

with:
java-version: 11

- name: Generate reference documentation and test links
run: |
./dotty/project/scripts/sbt scaladoc/generateReferenceDocumentation --no-regenerate-expected-links
./dotty/project/scripts/docsLinksStability ./dotty/scaladoc/output/reference ./dotty/project/scripts/expected-links/reference-expected-links.txt

- name: Push changes to scala3-reference-docs
if: github.event_name == 'push'
uses: actions/checkout@v3
with:
repository: lampepfl/scala3-reference-docs
fetch-depth: 0
submodules: true
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
path: 'scala3-reference-docs'

- if: github.event_name == 'push'
run: |
\cp -a dotty/scaladoc/output/reference/. scala3-reference-docs/
cd scala3-reference-docs
git config user.name gh-actions
git config user.email [email protected]
git add .
git commit -m "UPDATE ${{ steps.date.outputs.date }}"
git push
cd ..

- name: Merge changes to main
if: github.event_name == 'push'
run: |
cd dotty
git fetch origin main:main
git checkout main
git merge language-reference-stable
cd ..

- name: Create pull reuqest with backport to main
if: github.event_name == 'push'
uses: peter-evans/create-pull-request@v4
with:
path: dotty
branch: language-reference-backport
labels: area:documentation