diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..7b5e164 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,35 @@ +name: Deploy Worker + +on: + push: + branches: [main] + paths: + - 'worker/**' + - 'package.json' + - 'package-lock.json' + +jobs: + deploy: + name: Deploy to Cloudflare Workers + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: 'package.json' + - name: Cache npm + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Install dependencies + run: npm install + - name: Deploy worker + run: npm -w worker run deploy + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} diff --git a/.github/workflows/lint-build.yml b/.github/workflows/lint-build.yml index 2392f4a..a04b169 100644 --- a/.github/workflows/lint-build.yml +++ b/.github/workflows/lint-build.yml @@ -1,32 +1,34 @@ -name: CI +name: Lint and Build on: pull_request: branches: [main] - push: - branches: [main] jobs: - build: + lint-and-build: + name: Frontend & Worker — lint and build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 with: - node-version-file: package.json - + node-version-file: 'package.json' + - name: Cache npm + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Install dependencies run: npm install - - name: Lint frontend - run: npm run lint -w frontend - continue-on-error: true - + run: npm -w frontend run lint + - name: Lint worker + run: npm -w worker run lint - name: Build frontend - run: npm run build -w frontend - continue-on-error: true - + run: npm -w frontend run build - name: Build worker - run: npm run build -w worker - continue-on-error: true + run: npm -w worker run build