diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..124d30e --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,90 @@ +name: deploy + +on: + workflow_dispatch: + + pull_request: + types: + - opened + - synchronize + - reopened + - closed + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + test: + if: github.event.pull_request.merged == false + runs-on: ubuntu-latest + + defaults: + run: + working-directory: launchpad + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: launchpad/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Build website + run: npm run build + + - name: Run tests + run: npm run test + + - run: bash scripts/report.sh + env: + BOARD_URL: ${{ vars.BOARD_URL }} + SHIPIT_TOKEN: ${{ secrets.SHIPIT_TOKEN }} + + deploy: + needs: test + if: always() && github.event.pull_request.merged == true + runs-on: ubuntu-latest + + defaults: + run: + working-directory: launchpad + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: launchpad/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Build website + run: npm run build + env: + VITE_BOARD_URL: ${{ vars.BOARD_URL }} + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: launchpad/dist + + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v4 \ No newline at end of file