From 0c9b56b5934016220d63a3bc7caa2b466a44d070 Mon Sep 17 00:00:00 2001 From: ItsRauf <31735267+ItsRauf@users.noreply.github.com> Date: Sat, 27 Dec 2025 01:00:47 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20feat(ci):=20split=20github=20act?= =?UTF-8?q?ions=20across=20multiple=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/pink-owls-float.md | 12 +++++ .github/workflows/{ci.yml => changesets.yml} | 51 +++----------------- .github/workflows/tag-releases.yml | 49 +++++++++++++++++++ .github/workflows/validate.yml | 41 ++++++++++++++++ 4 files changed, 110 insertions(+), 43 deletions(-) create mode 100644 .changeset/pink-owls-float.md rename .github/workflows/{ci.yml => changesets.yml} (52%) create mode 100644 .github/workflows/tag-releases.yml create mode 100644 .github/workflows/validate.yml diff --git a/.changeset/pink-owls-float.md b/.changeset/pink-owls-float.md new file mode 100644 index 0000000..02767eb --- /dev/null +++ b/.changeset/pink-owls-float.md @@ -0,0 +1,12 @@ +--- +"@embedly/platforms": patch +"@embedly/builder": patch +"@embedly/logging": patch +"@embedly/config": patch +"@embedly/parser": patch +"@embedly/types": patch +"@embedly/api": patch +"@embedly/bot": patch +--- + +feat(ci): split github actions across multiple files diff --git a/.github/workflows/ci.yml b/.github/workflows/changesets.yml similarity index 52% rename from .github/workflows/ci.yml rename to .github/workflows/changesets.yml index 0710099..a7ab6a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/changesets.yml @@ -1,4 +1,5 @@ -name: CI +name: Changesets + env: PNPM_VERSION: "10.15.1" NODE_VERSION: "24" @@ -6,64 +7,31 @@ env: on: push: branches: [main] - pull_request: - branches: [main] concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Cache turbo build setup - uses: actions/cache@v4 - with: - path: .turbo - key: ${{ runner.os }}-turbo-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-turbo- - - name: Setup pnpm - uses: pnpm/action-setup@v2 - with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - - name: Install dependencies - run: pnpm install --frozen-lockfile - - name: Lint and format check - run: pnpm biome ci - - name: Build all packages - run: pnpm build release: - needs: build runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' + permissions: + contents: write + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 - - name: Setup pnpm - uses: pnpm/action-setup@v3 + uses: pnpm/action-setup@v2 with: version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: 'pnpm' - - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Get Release Version id: versioning run: | @@ -71,13 +39,10 @@ jobs: echo "VERSION=$(jq -r '.releases.[0].newVersion' release.json)" >> $GITHUB_OUTPUT rm release.json fi - - - name: Create Release Pull Request or Publish - id: changesets + - name: Create Release Pull Request uses: changesets/action@v1 with: - publish: pnpm changeset publish - title: '🔖 chore(release): v${{ steps.versioning.outputs.VERSION }}' commit: '🔖 chore(release): v${{ steps.versioning.outputs.VERSION }}' + title: '🔖 chore(release): v${{ steps.versioning.outputs.VERSION }}' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tag-releases.yml b/.github/workflows/tag-releases.yml new file mode 100644 index 0000000..1c63939 --- /dev/null +++ b/.github/workflows/tag-releases.yml @@ -0,0 +1,49 @@ +name: Tag Release + +on: + pull_request: + types: [closed] + branches: [main] + +jobs: + tag: + if: | + github.event.pull_request.merged == true && + startsWith(github.event.pull_request.title, '🔖 chore(release):') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: main + + - name: Get version from package.json + id: version + run: | + VERSION=$(jq -r '.version' apps/bot/package.json) + echo "VERSION=v$VERSION" >> $GITHUB_OUTPUT + echo "Creating tag: v$VERSION" + + - name: Check if tag exists + id: check_tag + run: | + if git rev-parse "${{ steps.version.outputs.VERSION }}" >/dev/null 2>&1; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + + - name: Create and push tag + if: steps.check_tag.outputs.exists == 'false' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a ${{ steps.version.outputs.VERSION }} -m "Release ${{ steps.version.outputs.VERSION }}" + git push origin ${{ steps.version.outputs.VERSION }} + + - name: Tag already exists + if: steps.check_tag.outputs.exists == 'true' + run: echo "Tag ${{ steps.version.outputs.VERSION }} already exists, skipping" diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..ecbabaa --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,41 @@ +name: Validate (Lint and Build) +env: + PNPM_VERSION: "10.15.1" + NODE_VERSION: "24" + +on: + push: + branches: ['**'] + pull_request: + branches: [main, devel] + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Cache turbo build setup + uses: actions/cache@v4 + with: + path: .turbo + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: ${{ env.PNPM_VERSION }} + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'pnpm' + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Lint and format check + run: pnpm biome ci + - name: Build all packages + run: pnpm build