Skip to content

Commit d8495b4

Browse files
committed
👷 feat(ci): split github actions across multiple files
1 parent 56940fe commit d8495b4

4 files changed

Lines changed: 110 additions & 43 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@embedly/platforms": patch
3+
"@embedly/builder": patch
4+
"@embedly/logging": patch
5+
"@embedly/config": patch
6+
"@embedly/parser": patch
7+
"@embedly/types": patch
8+
"@embedly/api": patch
9+
"@embedly/bot": patch
10+
---
11+
12+
feat(ci): split github actions across multiple files
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,48 @@
1-
name: CI
1+
name: Changesets
2+
23
env:
34
PNPM_VERSION: "10.15.1"
45
NODE_VERSION: "24"
56

67
on:
78
push:
89
branches: [main]
9-
pull_request:
10-
branches: [main]
1110

1211
concurrency: ${{ github.workflow }}-${{ github.ref }}
1312

1413
jobs:
15-
build:
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
- name: Cache turbo build setup
21-
uses: actions/cache@v4
22-
with:
23-
path: .turbo
24-
key: ${{ runner.os }}-turbo-${{ github.sha }}
25-
restore-keys: |
26-
${{ runner.os }}-turbo-
27-
- name: Setup pnpm
28-
uses: pnpm/action-setup@v2
29-
with:
30-
version: ${{ env.PNPM_VERSION }}
31-
- name: Setup Node.js
32-
uses: actions/setup-node@v4
33-
with:
34-
node-version: ${{ env.NODE_VERSION }}
35-
cache: 'pnpm'
36-
- name: Install dependencies
37-
run: pnpm install --frozen-lockfile
38-
- name: Lint and format check
39-
run: pnpm biome ci
40-
- name: Build all packages
41-
run: pnpm build
4214
release:
43-
needs: build
4415
runs-on: ubuntu-latest
45-
if: github.ref == 'refs/heads/main'
16+
permissions:
17+
contents: write
18+
pull-requests: write
4619
steps:
4720
- name: Checkout
4821
uses: actions/checkout@v4
4922
with:
50-
token: ${{ secrets.GITHUB_TOKEN }}
5123
fetch-depth: 0
52-
5324
- name: Setup pnpm
54-
uses: pnpm/action-setup@v3
25+
uses: pnpm/action-setup@v2
5526
with:
5627
version: ${{ env.PNPM_VERSION }}
57-
5828
- name: Setup Node.js
5929
uses: actions/setup-node@v4
6030
with:
6131
node-version: ${{ env.NODE_VERSION }}
6232
cache: 'pnpm'
63-
6433
- name: Install dependencies
6534
run: pnpm install --frozen-lockfile
66-
6735
- name: Get Release Version
6836
id: versioning
6937
run: |
7038
if pnpm changeset status --output release.json; then
7139
echo "VERSION=$(jq -r '.releases.[0].newVersion' release.json)" >> $GITHUB_OUTPUT
7240
rm release.json
7341
fi
74-
75-
- name: Create Release Pull Request or Publish
76-
id: changesets
42+
- name: Create Release Pull Request
7743
uses: changesets/action@v1
7844
with:
79-
publish: pnpm changeset publish
80-
title: '🔖 chore(release): v${{ steps.versioning.outputs.VERSION }}'
8145
commit: '🔖 chore(release): v${{ steps.versioning.outputs.VERSION }}'
46+
title: '🔖 chore(release): v${{ steps.versioning.outputs.VERSION }}'
8247
env:
8348
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Tag Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [main]
7+
8+
jobs:
9+
tag:
10+
if: |
11+
github.event.pull_request.merged == true &&
12+
startsWith(github.event.pull_request.title, '🔖 chore(release):')
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
ref: main
22+
23+
- name: Get version from package.json
24+
id: version
25+
run: |
26+
VERSION=$(jq -r '.version' apps/bot/package.json)
27+
echo "VERSION=v$VERSION" >> $GITHUB_OUTPUT
28+
echo "Creating tag: v$VERSION"
29+
30+
- name: Check if tag exists
31+
id: check_tag
32+
run: |
33+
if git rev-parse "${{ steps.version.outputs.VERSION }}" >/dev/null 2>&1; then
34+
echo "exists=true" >> $GITHUB_OUTPUT
35+
else
36+
echo "exists=false" >> $GITHUB_OUTPUT
37+
fi
38+
39+
- name: Create and push tag
40+
if: steps.check_tag.outputs.exists == 'false'
41+
run: |
42+
git config user.name "github-actions[bot]"
43+
git config user.email "github-actions[bot]@users.noreply.github.com"
44+
git tag -a ${{ steps.version.outputs.VERSION }} -m "Release ${{ steps.version.outputs.VERSION }}"
45+
git push origin ${{ steps.version.outputs.VERSION }}
46+
47+
- name: Tag already exists
48+
if: steps.check_tag.outputs.exists == 'true'
49+
run: echo "Tag ${{ steps.version.outputs.VERSION }} already exists, skipping"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Validate (Lint and Build)
2+
env:
3+
PNPM_VERSION: "10.15.1"
4+
NODE_VERSION: "24"
5+
6+
on:
7+
push:
8+
branches: ['**']
9+
pull_request:
10+
branches: [main, devel]
11+
12+
concurrency: ${{ github.workflow }}-${{ github.ref }}
13+
14+
jobs:
15+
validate:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- name: Cache turbo build setup
21+
uses: actions/cache@v4
22+
with:
23+
path: .turbo
24+
key: ${{ runner.os }}-turbo-${{ github.sha }}
25+
restore-keys: |
26+
${{ runner.os }}-turbo-
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v2
29+
with:
30+
version: ${{ env.PNPM_VERSION }}
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: ${{ env.NODE_VERSION }}
35+
cache: 'pnpm'
36+
- name: Install dependencies
37+
run: pnpm install --frozen-lockfile
38+
- name: Lint and format check
39+
run: pnpm biome ci
40+
- name: Build all packages
41+
run: pnpm build

0 commit comments

Comments
 (0)