diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..2ba838c5 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,45 @@ +name: Build +on: [push] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [24.x] + steps: + - name: Checkout repository + uses: actions/checkout@v5 + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v5 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm ci + + - name: Lint the code + run: npm run lint + + - name: Run the tests + run: npm test + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage/lcov.info + + release: + name: Deploy + runs-on: ubuntu-latest + needs: test + if: github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v5 + - name: Deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{secrets.CLOUDFLARE_API_TOKEN}} + accountId: ${{secrets.CLOUDFLARE_ACCOUNT_ID}} diff --git a/.github/workflows/deploy-main.yaml b/.github/workflows/deploy-main.yaml deleted file mode 100644 index d8b4aa53..00000000 --- a/.github/workflows/deploy-main.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: Deploy to production -on: - push: - branches: - - main - -jobs: - deploy: - runs-on: ubuntu-latest - name: Deploy - steps: - - uses: actions/checkout@v4 - - name: Deploy - uses: cloudflare/wrangler-action@v3 - with: - apiToken: ${{secrets.CLOUDFLARE_API_TOKEN}} - accountId: ${{secrets.CLOUDFLARE_ACCOUNT_ID}} diff --git a/.github/workflows/install-lint-test.yaml b/.github/workflows/install-lint-test.yaml deleted file mode 100644 index df72267a..00000000 --- a/.github/workflows/install-lint-test.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Install, lint, and test -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] -jobs: - run-tests: - name: Running tests - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [24.x] - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Set up Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: Install dependencies - run: npm ci - - - name: Lint the code - run: npm run lint - - - name: Run the tests - run: npm test - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage/lcov.info