pedestal_master_commit #136
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: CI | |
on: | |
push: | |
branches: | |
- master | |
repository_dispatch: | |
types: [pedestal_master_commit] | |
env: | |
UPLOAD_BUCKET: s3://pedestal.io-upload | |
DEPLOY_BUCKET: s3://pedestal.io | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4.0.1 | |
with: | |
aws-access-key-id: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.DOCS_AWS_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Checkout | |
uses: actions/checkout@v4.1.1 | |
# TODO: Cache Dependencies | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install Antora | |
run: | | |
npm install --save-dev --save-exact # Uses package.json, package-lock.json | |
npx antora -v | |
# Don't use Docker Cache; the cache is > 1 Gb, so it takes longer to download (~ 52s) | |
# than just pulling the images from Docker hub (~ 29 s). | |
- name: Start Kroki | |
run: docker compose up -d | |
- name: Run Antora | |
# --fetch forces a fetch even if the repo previously exists | |
run: npx antora --fetch antora-playbook.yml | |
- name: Stop Kroki | |
run: docker compose down | |
- name: Upload to AWS | |
# Clear the upload bucket, then copy files to the it. | |
run: | | |
aws s3 rm ${{ env.UPLOAD_BUCKET }} --recursive | |
aws s3 cp api ${{ env.UPLOAD_BUCKET }}/api --recursive | |
aws s3 cp build/site ${{ env.UPLOAD_BUCKET }} --recursive | |
aws s3 cp script/robots.txt ${{ env.UPLOAD_BUCKET }} | |
# Sync the temporary bucket to the real bucket (should be super fast). | |
# Goal here was to minimize disruption when rolling out changes. | |
- name: Sync upload to deployed | |
run: aws s3 sync ${{ env.UPLOAD_BUCKET }} ${{ env.DEPLOY_BUCKET }} --delete |