diff --git a/.github/workflows/build-preview.yml b/.github/workflows/build-preview.yml new file mode 100644 index 0000000..649a79c --- /dev/null +++ b/.github/workflows/build-preview.yml @@ -0,0 +1,36 @@ +name: Build Preview Deployment + +# cancel in-progress runs on new commits to same PR (github.event.number) +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + +on: + pull_request: + types: [opened, synchronize] + +jobs: + build-preview: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - name: Build site + run: pnpm build + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: preview-build + path: sites/docs/.svelte-kit/cloudflare diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc409cb..b6dc20d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,13 +21,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - name: Install pnpm with: - version: 8 - run_install: false + version: 9 - - name: Install Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: 20 cache: pnpm @@ -43,13 +40,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - name: Install pnpm with: - version: 8 - run_install: false + version: 9 - - name: Install Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: 20 cache: pnpm @@ -64,13 +58,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - name: Install pnpm with: - version: 8 - run_install: false + version: 9 - - name: Install Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: 20 cache: pnpm diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml new file mode 100644 index 0000000..3a6ebcc --- /dev/null +++ b/.github/workflows/deploy-preview.yml @@ -0,0 +1,37 @@ +name: Upload Preview Deployment + +on: + workflow_run: + workflows: [Build Preview Deployment] + types: + - completed + +permissions: + actions: read + deployments: write + contents: read + pull-requests: write + +jobs: + deploy-preview: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + id: preview-build-artifact + with: + name: preview-build + path: build + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + + - name: Deploy to Cloudflare Pages + uses: AdrianGonz97/refined-cf-pages-action@v1 + with: + apiToken: ${{ secrets.CF_API_TOKEN }} + accountId: ${{ secrets.CF_ACCOUNT_ID }} + githubToken: ${{ secrets.GITHUB_TOKEN }} + projectName: mode-watcher + deploymentName: Preview + directory: ${{ steps.preview-build-artifact.outputs.download-path }} diff --git a/.github/workflows/production.yml b/.github/workflows/deploy-prod.yml similarity index 77% rename from .github/workflows/production.yml rename to .github/workflows/deploy-prod.yml index bbf9b01..da318f2 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/deploy-prod.yml @@ -1,4 +1,4 @@ -name: Docs Production Deployment +name: Production Deployment on: push: branches: @@ -7,25 +7,20 @@ on: - sites/docs/** - packages/mode-watcher/** -concurrency: ${{ github.workflow }}-${{ github.ref }} - jobs: - publish: + deploy-production: runs-on: ubuntu-latest permissions: contents: read deployments: write - name: Publish to Cloudflare Pages + name: Deploy Production Site to Cloudflare Pages steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - name: Install pnpm with: - version: 8 - run_install: false + version: 9 - - name: Install Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: 20 cache: pnpm diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f6f487e..b32d500 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,14 +13,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: pnpm/action-setup@v4 - name: Install pnpm with: - version: 8 - run_install: false + version: 9 - - name: Install Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: 20 cache: pnpm diff --git a/package.json b/package.json index bd5d9fe..adb0fba 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "build:packages": "pnpm -F \"./packages/**\" --parallel build", "ci:publish": "pnpm build:packages && changeset publish", "lint": "prettier --check . && eslint .", + "lint:fix": "eslint --fix .", "format": "prettier --write .", "check": "pnpm build:packages && pnpm -r check" },