Fixing website urls to local references and hosted binary files #17
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: Build Hugo Website | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| paths: | |
| - 'docs/website/**' | |
| - 'scripts/website/**' | |
| - '.github/workflows/website-docs.yml' | |
| push: | |
| branches: [main, master] | |
| paths: | |
| - 'docs/website/**' | |
| - 'scripts/website/**' | |
| - '.github/workflows/website-docs.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN || secrets.CF_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID || secrets.CF_ACCOUNT_ID }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Hugo | |
| uses: peaceiris/actions-hugo@v3 | |
| with: | |
| hugo-version: 'latest' | |
| extended: true | |
| - name: Set up Java 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '25' | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.3' | |
| - name: Install Asciidoctor tooling | |
| run: | | |
| set -euo pipefail | |
| gem install --no-document asciidoctor rouge | |
| - name: Download latest OTA skins | |
| run: | | |
| set -euo pipefail | |
| scripts/website/fetch_ota_skins.sh | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: Update developer guide PDF redirect | |
| run: | | |
| set -euo pipefail | |
| scripts/website/update_developer_guide_redirect.sh | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: Build website | |
| run: | | |
| set -euo pipefail | |
| scripts/website/build.sh | |
| env: | |
| WEBSITE_INCLUDE_JAVADOCS: "true" | |
| WEBSITE_INCLUDE_DEVGUIDE: "true" | |
| - name: Validate OTA skin output | |
| run: | | |
| set -euo pipefail | |
| test -f docs/website/public/OTA/Skins.xml | |
| - name: Validate developer guide redirect output | |
| run: | | |
| set -euo pipefail | |
| test -f docs/website/public/_redirects | |
| grep -Eq '^/files/developer-guide\.pdf https://github\.com/codenameone/CodenameOne/releases/download/.+/developer-guide\.pdf 302$' docs/website/public/_redirects | |
| - name: Upload built site artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: website-preview | |
| path: docs/website/public | |
| if-no-files-found: error | |
| - name: Check Cloudflare deploy credentials | |
| if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master') && env.CLOUDFLARE_TOKEN == '' }} | |
| run: | | |
| echo "::warning::Skipping Cloudflare Pages deploy because no API token secret is configured. Set CLOUDFLARE_TOKEN (preferred) or CF_API_TOKEN." | |
| - name: Deploy to Cloudflare Pages | |
| if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master') && env.CLOUDFLARE_TOKEN != '' }} | |
| uses: cloudflare/wrangler-action@v3 | |
| env: | |
| # Keep these env vars explicit so Wrangler can authenticate in non-interactive CI. | |
| CLOUDFLARE_API_TOKEN: ${{ env.CLOUDFLARE_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ env.CLOUDFLARE_ACCOUNT_ID }} | |
| with: | |
| # Also pass through action inputs for compatibility with wrangler-action versions. | |
| apiToken: ${{ env.CLOUDFLARE_TOKEN }} | |
| accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }} | |
| command: >- | |
| pages deploy docs/website/public | |
| --project-name=${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || secrets.CLOUDFLARE_PAGES_PROJECT_NAME || secrets.CF_PAGES_PROJECT_NAME || 'codenameone' }} | |
| --branch=${{ vars.CLOUDFLARE_PAGES_PRODUCTION_BRANCH || secrets.CLOUDFLARE_PAGES_PRODUCTION_BRANCH || 'main' }} |