Fix links in docs page when base path is set #148
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: [ master, vertx5 ] | |
concurrency: | |
group: master-deploy | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
# these permissions are required for the deploy-pages action to work properly | |
pages: write | |
id-token: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
# links this workflow to the deployments page on your repository | |
name: github-pages | |
# attaches the deployed URL to this job on the workflow summary | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
# Delete tools not needed for the build process | |
# This saves about 4GB of disk space | |
- name: Delete unnecesary tools | |
run: | | |
df -h / | |
sudo rm -rf /usr/local/share/boost | |
sudo rm -rf $AGENT_TOOLSDIRECTORY | |
df -h / | |
# Checkout master | |
- uses: actions/checkout@v2 | |
with: | |
ref: master | |
# Checkout vertx5 branch | |
- uses: actions/checkout@v2 | |
with: | |
ref: vertx5 | |
path: vertx5 | |
# Remove more unnecessary tools. We should have about 52GB of free disk space after this. | |
# See https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh | |
# NOT NEEDED AT THE MOMENT - DISK SIZE IS LARGE ENOUGH | |
# RE-ENABLE LATER IF NECESSARY | |
# - name: Free up more disk space | |
# run: | | |
# .github/workflows/free_disk_space.sh | |
- name: Setup Node.js 20.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 20.x | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
.cache | |
.next/cache | |
docs/compiled | |
vertx5/docs/compiled | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-build- | |
- run: | | |
du -sh * | |
df -h / /mnt | |
- run: npm ci -f | |
# Install dependencies for vertx5 | |
- run: npm ci -f | |
working-directory: vertx5 | |
# Necessary to generate OpenGraph images | |
- name: Install Chromium for Playwright | |
run: npx playwright install --with-deps chromium | |
# Download, extract, and compile docs | |
- run: npm run update-docs | |
- run: | | |
du -sh * | |
df -h / /mnt | |
# Compile vertx5 docs (only latest bugfix versions to save time and space) | |
- run: npm run update-docs -- --latest-bugfix-versions-only | |
working-directory: vertx5/docs | |
# Remove files that have been used while running 'update-docs' but that | |
# are not needed anymore for the remainder of the workflow. This is | |
# necessary to save disk space. | |
- name: Cleanup temporary files | |
run: | | |
rm -rf docs/download | |
rm -rf docs/extracted | |
rm -rf docs/node_modules | |
rm -rf vertx5/docs/download | |
rm -rf vertx5/docs/extracted | |
rm -rf vertx5/docs/node_modules | |
- run: | | |
du -sh * | |
df -h / /mnt | |
# Temporarily move apidocs out of the way | |
- run: | | |
mkdir .apidocs_temp | |
mv public/docs/* .apidocs_temp | |
# Temporarily move apidocs out of the way (vertx5) | |
- run: | | |
mkdir .apidocs_temp | |
mv public/docs/* .apidocs_temp | |
working-directory: vertx5 | |
# Build website | |
- run: npm run build | |
env: | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
- run: | | |
du -sh * | |
df -h / /mnt | |
# Build vertx5 website | |
- run: | | |
cp -r .cache vertx5/.cache | |
mkdir -p vertx5/.next | |
cp -r .next/cache vertx5/.next/cache | |
- run: npm run build | |
env: | |
VERTX_WEBSITE_BASEPATH: vertx5 | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
working-directory: vertx5 | |
- run: | | |
du -sh * | |
df -h / /mnt | |
# Remove files that have been used during build but that are not needed | |
# anymore for the remainder of the workflow. This is necessary to save | |
# disk space. | |
- name: Cleanup temporary files | |
run: | | |
rm -rf node_modules | |
rm -rf vertx5/node_modules | |
- run: | | |
du -sh * | |
df -h / /mnt | |
- name: Prepare output directory | |
run: | | |
mkdir vertx-web-site.github.io | |
cd vertx-web-site.github.io | |
touch .nojekyll | |
echo vertx.io > CNAME | |
cd .. | |
- name: Copy build to output directory | |
run: | | |
shopt -s dotglob # include dot files | |
mv out/* vertx-web-site.github.io | |
mkdir vertx-web-site.github.io/vertx5 | |
mv vertx5/out/* vertx-web-site.github.io/vertx5 | |
- name: Copy API docs into output directory | |
run: | | |
mv .apidocs_temp/apidocs vertx-web-site.github.io/docs/ | |
find .apidocs_temp -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n1 -I '{}' sh -xc 'mv {}/* vertx-web-site.github.io/docs/$(basename {})/' | |
mv vertx5/.apidocs_temp/apidocs vertx-web-site.github.io/vertx5/docs/ | |
find vertx5/.apidocs_temp -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n1 -I '{}' sh -xc 'mv {}/* vertx-web-site.github.io/vertx5/docs/$(basename {})/' | |
- run: | | |
du -sh * | |
df -h / /mnt | |
- name: Create Archive | |
run: | | |
cd vertx-web-site.github.io | |
tar --dereference --hard-dereference -cf ../website.tar . | |
- name: Upload Archive | |
uses: actions/upload-artifact@v3 | |
with: | |
name: github-pages | |
path: website.tar | |
retention-days: 1 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |