From 6675ef8da26ac4a79dc707390d76201efcf93729 Mon Sep 17 00:00:00 2001 From: xiange Date: Tue, 12 Nov 2024 14:12:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=8E=20ci:=20test=20deploy=20to=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 51 +++++++++++++++++++++++++++ .github/workflows/deploy-to-pages.yml | 46 ++++++++++++++++++++++++ .github/workflows/main.yml | 27 -------------- 3 files changed, 97 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/deploy-to-pages.yml delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..4bab950d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: test and deploy + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + run: npm install + + - name: Run unit tests + run: npm run test + + - name: Build + run: | + npm run build + rm -rf dist/*.map + + deploy: + needs: test + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + run: npm install + + - name: Build + run: | + npm run build \ No newline at end of file diff --git a/.github/workflows/deploy-to-pages.yml b/.github/workflows/deploy-to-pages.yml new file mode 100644 index 00000000..a54dcdde --- /dev/null +++ b/.github/workflows/deploy-to-pages.yml @@ -0,0 +1,46 @@ +name: Deploy chili3d to Pages + +on: + push: + branches: [ "test" ] + pull_request: + branches: [ "test" ] + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Build + run: | + npm install + npm run build + rm -rf dist/*.map + + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v3.0.1 + with: + path: ./dist + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index d02554f0..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Test - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - -jobs: - test-and-deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install dependencies - run: npm install - - - name: Run unit tests - run: npm run test - \ No newline at end of file