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