|
| 1 | +name: Turbopack Nightly Release |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "15 8 * * *" # Run every day at 00:15 PST |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + version: |
| 9 | + description: Turbopack (Next.js) version, sha, branch to generate docs |
| 10 | + type: string |
| 11 | + default: "canary" |
| 12 | + prod: |
| 13 | + description: Deploy docs to production |
| 14 | + type: boolean |
| 15 | + default: false |
| 16 | + |
| 17 | +jobs: |
| 18 | + # deploy turbopack-specific packages' rustdoc documentation. |
| 19 | + turbopack_deploy_rustdocs: |
| 20 | + name: Deploy Turbopack rustdocs |
| 21 | + runs-on: ubuntu-latest |
| 22 | + continue-on-error: true |
| 23 | + if: github.repository_owner == 'vercel' |
| 24 | + env: |
| 25 | + TURBOPACK_RUST_DOCS_VERCEL_CLI_DEPLOY: ${{ secrets.TURBOPACK_RUST_DOCS_VERCEL_CLI_DEPLOY }} |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Find Next.js latest release version |
| 31 | + env: |
| 32 | + GH_TOKEN: ${{ github.token }} |
| 33 | + run: | |
| 34 | + # Grab the latest release version from next.js repo, including prelease. `/releases/latest` will only return latest stable release. |
| 35 | + echo NEXJS_LATEST_VERSION=$(gh release --repo vercel/next.js --limit 1 list | sed -n 1p | awk '{print $1}') >> $GITHUB_ENV |
| 36 | +
|
| 37 | + - name: Set Next.js release version |
| 38 | + run: | |
| 39 | + echo "NEXTJS_VERSION=${{ inputs.version != '' && inputs.version || env.NEXJS_LATEST_VERSION }}" >> $GITHUB_ENV |
| 40 | +
|
| 41 | + - name: Print Next.js release version to checkout |
| 42 | + run: echo "Checking out Next.js ${{ env.NEXTJS_VERSION }}" |
| 43 | + |
| 44 | + - name: Checkout |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + repository: vercel/next.js |
| 48 | + path: nextjs_upstream |
| 49 | + |
| 50 | + - uses: ./.github/actions/setup-node |
| 51 | + |
| 52 | + - name: Setup Rust |
| 53 | + uses: ./.github/actions/setup-rust |
| 54 | + with: |
| 55 | + github-token: "${{ secrets.GITHUB_TOKEN }}" |
| 56 | + |
| 57 | + - name: Build rustdoc |
| 58 | + run: | |
| 59 | + # Temporary index page |
| 60 | + printf "# Turbopack \n\nWelcome to an overview of the Turbopack documentation.\nCurrently it's work in progress, the only package available is [Turbo tasks-fs](turbo_tasks_fs/index.html)" > index.md |
| 61 | + RUSTDOCFLAGS="-Z unstable-options --index-page $(pwd)/index.md" cargo doc --manifest-path ./nextjs_upstream/Cargo.toml --target-dir out_docs -p turbo-tasks-fs --no-deps |
| 62 | +
|
| 63 | + - name: Link project |
| 64 | + run: | |
| 65 | + npx vercel link --cwd ./out_docs/doc --project turbopack-rust-docs --token=$TURBOPACK_RUST_DOCS_VERCEL_CLI_DEPLOY --scope=vercel --yes |
| 66 | +
|
| 67 | + - name: Trigger deploy |
| 68 | + if: ${{ github.ref != 'refs/heads/main' || !inputs.prod }} |
| 69 | + run: | |
| 70 | + npx vercel deploy --cwd ./out_docs/doc --token=$TURBOPACK_RUST_DOCS_VERCEL_CLI_DEPLOY --scope=vercel --yes |
| 71 | +
|
| 72 | + - name: Trigger deploy (prod) |
| 73 | + if: ${{ github.ref == 'refs/heads/main' || inputs.prod }} |
| 74 | + run: | |
| 75 | + npx vercel deploy --cwd ./out_docs/doc --token=$TURBOPACK_RUST_DOCS_VERCEL_CLI_DEPLOY --scope=vercel --prod --yes |
0 commit comments