Skip to content

Commit

Permalink
ci: another attempt at docs publishing (#1232)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepfred authored Nov 28, 2024
1 parent 6c25aa0 commit 65ce797
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 28 deletions.
42 changes: 33 additions & 9 deletions .github/workflows/pull_request_secure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ name: Secured Workflow

on:
push:
branches: [main]
branches: [ main ]
# There are two differences to "pull_request" here:
# - The workflow will receive secrets, even in PRs from forks.
# - The workflow will be executed automatically, without requiring a manual approval.
# Therefore the workflow needs to be explicitly secured; see "known_user" and "approval_required" jobs below.
pull_request_target:
branches: [main] # Benchmarks aren't branched, so they will only ever work against current main.
branches: [ main ] # Benchmarks aren't branched, so they will only ever work against current main.
types:
- opened
- reopened
Expand Down Expand Up @@ -266,13 +266,7 @@ jobs:
name: Build Documentation
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GURL: "https://github.com/${{ github.event.pull_request.head.repo.owner.login || 'TimefoldAI' }}/timefold-solver"
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
Expand All @@ -287,13 +281,43 @@ jobs:
node-version-file: .nvmrc
cache: npm

- name: Checkout timefold-solver
uses: actions/checkout@v4
with:
repository: "${{ github.event.pull_request.head.repo.owner.login || 'TimefoldAI' }}/timefold-solver"
ref: ${{ github.event.pull_request.head.sha || 'main' }} # The GHA event will pull the main branch by default, and we must specify the PR reference version
path: "./timefold-solver"
fetch-depth: 0

- 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: Updating Antora configuration
working-directory: "./timefold-solver"
run: |
echo "=== Updating antora.yml"
cp docs/src/antora-template.yml docs/src/antora.yml
sed -i "s/\${project\.version}b0/SNAPSHOT/g" docs/src/antora.yml
sed -i "s/\${project\.version}/SNAPSHOT/g" docs/src/antora.yml
sed -i "s/\${maven\.compiler\.release}/$(find build/build-parent/ -name pom.xml -exec grep '<maven.compiler.release>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)/g" docs/src/antora.yml
sed -i "s/\${maven\.min\.version}/$(find build/build-parent/ -name pom.xml -exec grep '<maven.min.version>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)/g" docs/src/antora.yml
sed -i "s/\${version\.io\.quarkus}/$(find build/build-parent/ -name pom.xml -exec grep '<maven.min.version>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)/g" docs/src/antora.yml
sed -i "s/\${version\.org\.springframework\.boot}/$(find build/build-parent/ -name pom.xml -exec grep '<version.ch.qos.logback>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)N/g" docs/src/antora.yml
sed -i "s/\${version\.ch\.qos\.logback}/$(find build/build-parent/ -name pom.xml -exec grep '<version.ch.qos.logback>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)/g" docs/src/antora.yml
sed -i "s/\${version\.exec\.plugin}/$(find build/build-parent/ -name pom.xml -exec grep '<version.exec.plugin>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)/g" docs/src/antora.yml
sed -i "s/\${version\.rewrite\.plugin}/$(find . -name pom.xml -exec grep '<version.rewrite.plugin>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)/g" docs/src/antora.yml
cat docs/src/antora.yml
- name: Build Documentation
working-directory: "./"
env:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
run: |
yq -i e 'del(.content.sources)' apps/docs/antora-playbook.yml
yq -i e 'del(.site.keys)' 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
yq -i e '.content.sources += [{"url": "../../timefold-solver", "start_path": "docs/src"}]' apps/docs/antora-playbook.yml
npm ci
npm run build -- --filter docs
Expand Down
19 changes: 0 additions & 19 deletions docs/src/antora.yml

This file was deleted.

0 comments on commit 65ce797

Please sign in to comment.