From 72c19181bf27a3bcff831c394e380e7b860f4459 Mon Sep 17 00:00:00 2001 From: Hunter Johnston <64506580+huntabyte@users.noreply.github.com> Date: Thu, 12 Dec 2024 22:01:13 -0500 Subject: [PATCH] chore: update ci for next (#195) --- .github/workflows/build-preview.yml | 44 +++++------ .github/workflows/ci.yml | 105 +++++++++++++-------------- .github/workflows/deploy-preview.yml | 58 +++++++-------- .github/workflows/deploy-prod.yml | 68 ++++++++--------- .github/workflows/release.yml | 63 ++++++++-------- 5 files changed, 164 insertions(+), 174 deletions(-) diff --git a/.github/workflows/build-preview.yml b/.github/workflows/build-preview.yml index 573e792..7788079 100644 --- a/.github/workflows/build-preview.yml +++ b/.github/workflows/build-preview.yml @@ -2,32 +2,32 @@ 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 + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true on: - pull_request: - types: [opened, synchronize] + pull_request: + types: [opened, synchronize] jobs: - build-preview: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm + build-preview: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm - - name: Install dependencies - run: pnpm install + - name: Install dependencies + run: pnpm install - - name: Build site - run: pnpm build + - 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 + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: preview-build + path: docs/.svelte-kit/cloudflare diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e210fbb..0c2c6bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,63 +1,56 @@ name: CI on: - push: - branches: - - main - pull_request: + push: + branches: + - main + - next + paths-ignore: + - ".changeset/**" + - README.md + - ".vscode/**" + - CHANGELOG.md + pull_request: + paths-ignore: + - ".changeset/**" + - README.md + - ".vscode/**" + - CHANGELOG.md concurrency: - group: ${{ github.workflow }}-${{ github.event.number || github.sha }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true jobs: - Check: - name: Run svelte-check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm - - - name: Install dependencies - run: pnpm install - - - name: Run svelte-check - run: pnpm check - - Lint: - runs-on: ubuntu-latest - name: Lint - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm - - - name: Install dependencies - run: pnpm install - - - name: Lint - run: pnpm lint - - Test: - name: Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm - - - name: Install dependencies - run: pnpm install - - - name: Test - run: pnpm test + Check: + name: Run svelte-check + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - name: Run svelte-check + run: pnpm check + + Lint: + runs-on: macos-latest + name: Lint + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - run: pnpm lint diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index 9a88184..9fbf454 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -1,37 +1,37 @@ name: Upload Preview Deployment on: - workflow_run: - workflows: ["Build Preview Deployment"] - types: - - completed + workflow_run: + workflows: [Build Preview Deployment] + types: + - completed permissions: - actions: read - deployments: write - contents: read - pull-requests: write + 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 }} + deploy-preview: + runs-on: macos-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: formsnap - deploymentName: Preview - directory: ${{ steps.preview-build-artifact.outputs.download-path }} + - 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: formsnap + deploymentName: Preview + directory: ${{ steps.preview-build-artifact.outputs.download-path }} diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index a4aaedc..59f580a 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -1,40 +1,42 @@ name: Production Deployment on: - push: - branches: - - main - paths: - - sites/docs/** - - packages/formsnap/** + push: + branches: + - main + paths: + - docs/** + - packages/formsnap/** + workflow_dispatch: + jobs: - deploy-production: - runs-on: ubuntu-latest - permissions: - contents: read - deployments: write - name: Deploy Production Site to Cloudflare Pages - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm + deploy-production: + runs-on: macos-latest + permissions: + contents: read + deployments: write + name: Deploy Production Site to Cloudflare Pages + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm - - name: Install dependencies - run: pnpm install + - name: Install dependencies + run: pnpm install - - name: Build site - run: pnpm build + - name: Build site + run: pnpm build - - 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: formsnap - directory: ./.svelte-kit/cloudflare - workingDirectory: sites/docs - deploymentName: Production + - 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: formsnap + directory: ./.svelte-kit/cloudflare + workingDirectory: docs + deploymentName: Production diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 14b668e..d864b6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,43 +1,38 @@ name: Release on: - push: - branches: - - main - - next + push: + branches: + - main + - next concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: - release: - permissions: - contents: write # to create release (changesets/action) - pull-requests: write # to create pull request (changesets/action) - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits - fetch-depth: 0 + release: + permissions: + contents: write # to create release (changesets/action) + pull-requests: write # to create pull request (changesets/action) + name: Release + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm + - name: Install dependencies + run: pnpm install - - name: Install dependencies - run: pnpm install - - - name: Create Release Pull Request or Publish to npm - id: changesets - uses: changesets/action@v1 - with: - commit: "chore(release): version package" - title: "chore(release): version package" - publish: pnpm ci:publish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + publish: pnpm ci:publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }}