[fix] Allow easily building docs with local changes again #251 #569
Workflow file for this run
This file contains hidden or 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: OpenWISP Docs | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.12 | |
| cache: "pip" | |
| cache-dependency-path: | | |
| **/requirements*.txt | |
| - name: Install test dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install libcairo2-dev poppler-utils | |
| pip install -U pip wheel setuptools | |
| pip install -U -r requirements.txt | |
| - name: Install npm dependencies | |
| run: sudo npm install -g prettier | |
| - name: QA checks, Build, Validate links (no 404s allowed), Check PDF | |
| run: PRODUCTION=1 ./run-qa-checks | |
| - name: Setup Google Cloud | |
| if: ${{ github.event_name=='push' }} | |
| uses: "google-github-actions/auth@v3" | |
| with: | |
| credentials_json: ${{ secrets.GCS_DOWNLOADS_SERVICE_ACCOUNT_JSON }} | |
| project_id: ${{ secrets.GCS_PROJECT_ID }} | |
| export_environment_variables: true | |
| - name: Set up Cloud SDK | |
| if: ${{ github.event_name=='push' }} | |
| uses: "google-github-actions/setup-gcloud@v3" | |
| - name: Deploy pages to openwisp.io/docs | |
| if: ${{ github.event_name=='push' }} | |
| run: | | |
| gsutil -m rsync -r ${{ env.SRC_URL }} ${{ env.DST_URL }} | |
| env: | |
| SRC_URL: /home/runner/work/openwisp-docs/openwisp-docs/_build/docs/ | |
| DST_URL: gs://${{ secrets.GCS_DOCS_BUCKET_NAME }}/docs/ | |
| invalidate-cache: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: ${{ needs.build.result == 'success' }} | |
| steps: | |
| - name: Authenticate to Google Cloud | |
| if: ${{ github.event_name=='push' }} | |
| uses: google-github-actions/auth@v3 | |
| with: | |
| credentials_json: ${{ secrets.GCS_DOWNLOADS_SERVICE_ACCOUNT_JSON }} | |
| project_id: ${{ secrets.GCS_PROJECT_ID }} | |
| export_environment_variables: true | |
| - name: Invalid CDN cache on GCP | |
| if: ${{ github.event_name=='push' }} | |
| uses: stefanodotit/github-actions-invalidate-gcp-cdn@v1 | |
| with: | |
| load_balancer_name: ${{ secrets.GCS_MAIN_LOAD_BALANCER_NAME }} | |
| host: openwisp.io | |
| path: "/docs/*" |