Deploy #179
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] | |
schedule: | |
- cron: "45 5 * * *" | |
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@v4 | |
with: | |
ref: master | |
# 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@v4 | |
with: | |
node-version: 20.x | |
# Temporarily disabled | |
# - uses: actions/cache@v4 | |
# with: | |
# path: | | |
# .cache | |
# .next/cache | |
# docs/compiled | |
# key: ${{ runner.os }}-build-${{ github.sha }} | |
# restore-keys: | | |
# ${{ runner.os }}-build- | |
- run: | | |
du -sh * | |
df -h / /mnt | |
- run: npm ci -f | |
# 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 | |
# 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 | |
- run: | | |
du -sh * | |
df -h / /mnt | |
# Temporarily move apidocs out of the way | |
- run: | | |
mkdir .apidocs_temp | |
mv public/docs/* .apidocs_temp | |
# Build website | |
- run: npm run build | |
env: | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
- 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 | |
- 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 | |
- 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 -not -empty -print0 | xargs -0 -n1 -I '{}' sh -xc 'mkdir -p vertx-web-site.github.io/docs/$(basename {})/ && mv {}/* vertx-web-site.github.io/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@v4 | |
with: | |
name: github-pages | |
path: website.tar | |
retention-days: 1 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |