From ec506586af10a7c2f385c4fcc1f3ef236de3d5d1 Mon Sep 17 00:00:00 2001 From: Joone Hur Date: Wed, 27 Mar 2024 16:34:25 -0700 Subject: [PATCH] Add build.yml --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..4c7164ca --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: CI + +on: + push: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v2 + name: Checkout src repo + with: + path: src + fetch-depth: 0 + ref: main + submodules: recursive + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.x' # Or your desired version + + - name: Install dependencies + run: npm install + working-directory: src + + - name: Build + run: npm run build + working-directory: src + + # Checkout destination repository + - name: Checkout dest repo + uses: actions/checkout@v2 + with: + path: dest + fetch-depth: 0 + ref: gh-pages + + # Copy the built website files + - name: Copy website built from src/docs folder + working-directory: dest + run: | + rm -rf * + yes | cp -rf ../src/docs/* . # Replace '(output_folder)' with your build output dir + + # Commit and push changes + - name: Commit website updates + working-directory: dest + run: | + git config --global user.name github-actions + git config --global user.email github-actions@github.com + git add . + git diff-index --quiet HEAD || git commit -m "Deploy website updates with GitHub Actions: ${GITHUB_SHA}" + git push origin gh-pages