examples icon indicating copy to clipboard operation
examples copied to clipboard

Customizing the build step for ci-cd/github-actions

Open DanRoscigno opened this issue 1 year ago • 2 comments

I am setting up a deployment of a Docusaurus site to Vercel, but I do not want to use your automated build. I would like to use my own GitHub action steps to build, as I need to grab some external files from another GitHub repo, and then upload the generated site.

I am seeing the error "Config file was not found at "/vercel/path0/.vercel/output/config.json"

Run vercel deploy --prebuilt --token=***
  
Vercel CLI 28.18.2
Retrieving project…
Deploying danroscigno/docpreview
Uploading [====================] (956.0KB/956KB)
Inspect: https://vercel.com/danroscigno/docpreview/2n9PhpWYP6ZEV95tm5ugLfwCVMeC [4s]
Queued
Building
Error: Config file was not found at "/vercel/path0/.vercel/output/config.json"
https://docpreview-j7w7p310z-danroscigno.vercel.app/
Error: Process completed with exit code 1.

Here is my workflow file:

name: GitHub Actions Vercel Preview Deployment
env:
  VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
  VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
  push:
    branches-ignore:
      - main
jobs:
  Deploy-Preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install Vercel CLI
        run: npm install --global vercel@canary
      - name: Pull Vercel Environment Information
        run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
      - name: Download Reference Doc
        run:  |
          curl https://codeload.github.com/ClickHouse/ClickHouse/tar.gz/master | tar -xz -C ./ --strip=2 "ClickHouse-master/docs/"
          cp ./en/sql-reference/syntax.md docs/
      - name: Set up Node
        uses: actions/setup-node@v3
        with:
          node-version: 18
      # Install and build Docusaurus website
      - name: Build Docusaurus website
        run: |
          export NODE_OPTIONS="--max_old_space_size=4096"
          npm install -g yarn
          yarn install
          yarn build --out-dir .vercel/output
      - name: Deploy Project Artifacts to Vercel
        run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

Thanks so much!

DanRoscigno avatar Mar 28 '23 23:03 DanRoscigno

I think that this issue can be summarized with:

When using the example CI/CD workflows a configuration file (.vercel/output/config.json) is necessary.

What I do not know is: what needs to go in this file?

I am getting past this because I am using Docusaurus, and Vercel provides a build command for this, so I have simplified the above copy of my workflow to just copy in my files and then let vercel build do its thing. Once I have created a new project and started over from scratch I will document this if you like.

DanRoscigno avatar Mar 29 '23 14:03 DanRoscigno

@DanRoscigno can you Build Output example please?

example with the file: https://github.com/vercel/examples/tree/main/build-output-api/static-files

docs for Verecl Build Output https://vercel.com/docs/build-output-api/v3

dominiksipowicz avatar Mar 29 '23 22:03 dominiksipowicz