Skip to content
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

chore: update the CI to compile and deploy Antora docs #1140

Merged
merged 8 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
cache: 'maven'

- name: Build and test timefold-solver
run: mvn -B -Dfull verify
run: mvn -B verify
python:
name: "Python Solver"
concurrency:
Expand Down
67 changes: 61 additions & 6 deletions .github/workflows/pull_request_secure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ jobs:
- id: validation
shell: bash
run: |
echo "Authorized user: ${{ steps.auth_check.outputs.authorized }}"
echo "Authorized user: ${{ steps.auth_check.outputs.authorized }}"
# If the user is not a member, require a member to approve the PR.
approval_required:
needs: known_user
environment:
${{
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
(needs.known_user.outputs.is_member_of_org != 'true' || github.actor == 'dependabot[bot]') &&
'external' || 'internal'
${{
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
(needs.known_user.outputs.is_member_of_org != 'true' || github.actor == 'dependabot[bot]') &&
'external' || 'internal'
}}
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -259,6 +259,61 @@ jobs:
env:
PIP_FIND_LINKS: ${{ github.workspace }}/timefold-solver/dist
run: tox

build_documentation:
runs-on: ubuntu-latest
needs: approval_required
name: Build Documentation
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Install yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
- name: Checkout frontend
id: checkout-frontend
uses: actions/checkout@v4
with:
repository: TimefoldAI/frontend
token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} # Safe; only used to clone the repo and not stored in the fork.
fetch-depth: 0 # Otherwise merge will fail on account of not having history.

- name: Checkout timefold-solver
uses: actions/checkout@v4
with:
path: ./timefold-solver

- name: Set up NodeJs
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Build Documentation
env:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
run: |
cd ${{ github.workspace }}/timefold-solver/
export GURL="$(git remote get-url origin)"
cd -
yq -i e 'del(.content.sources)' apps/docs/antora-playbook.yml
yq -i e '.content.sources += [{"url": env(GURL), "branches": env(BRANCH_NAME), "start_path": "docs/src"}]' apps/docs/antora-playbook.yml
npm ci
npm run build -- --filter docs
- name: Deploy Documentation (Preview Mode)
if: ${{ env.BRANCH_NAME != 'main' }}
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: ./apps/docs
command: pages deploy ./public-serve --project-name=timefold-docs --branch=${{ github.ref }}

sonarcloud:
needs: approval_required
name: SonarCloud
Expand Down
Loading