@@ -12,6 +12,22 @@ permissions:
1212 contents : write
1313
1414jobs :
15+ changes :
16+ runs-on : ubuntu-latest
17+ outputs :
18+ editor : ${{ steps.filter.outputs.editor }}
19+ browser : ${{ steps.filter.outputs.browser }}
20+ steps :
21+ - uses : actions/checkout@v4
22+ - uses : dorny/paths-filter@v3
23+ id : filter
24+ with :
25+ filters : |
26+ editor:
27+ - 'apps/editor/package.json'
28+ browser:
29+ - 'apps/browser/src/manifest.json'
30+
1531 check :
1632 runs-on : ubuntu-latest
1733
@@ -20,17 +36,17 @@ jobs:
2036 uses : actions/checkout@v4
2137
2238 - name : Setup PNPM
23- uses : pnpm/action- setup@v2
39+ uses : pnpm/setup@v3
2440 with :
2541 version : 12.17.0
26- run_install : false
42+ cache : true
43+ install : false
2744
2845 - name : Setup Node.js
2946 uses : actions/setup-node@v4
3047 with :
3148 node-version : ' 22'
3249 registry-url : ' https://registry.npmjs.org'
33- cache : ' pnpm'
3450
3551 - name : Install dependencies
3652 run : pnpm i
4561 run : pnpm test
4662
4763 release :
48- needs : check
64+ needs : [check, changes]
65+ if : needs.changes.outputs.editor == 'true'
4966 runs-on : ubuntu-latest
5067
5168 steps :
@@ -59,44 +76,19 @@ jobs:
5976 id : package_version
6077 run : |
6178 VERSION=$(jq -r .version apps/editor/package.json)
62- echo "version=$VERSION-vscode" >> $GITHUB_OUTPUT
6379 echo "raw_version=$VERSION" >> $GITHUB_OUTPUT
6480
65- - name : Check if tag exists
66- id : check_tag
67- run : |
68- # Prevent failing if package.json was modified but version wasn't bumped
69- if git ls-remote --tags origin refs/tags/${{ steps.package_version.outputs.version }} | grep -q 'refs/tags/'; then
70- echo "exists=true" >> $GITHUB_OUTPUT
71- else
72- echo "exists=false" >> $GITHUB_OUTPUT
73- fi
74-
75- - name : Generate Release Notes
76- if : steps.check_tag.outputs.exists == 'false'
77- run : |
78- PREV_TAG=$(git describe --tags --match "*-vscode" --abbrev=0 2>/dev/null || echo "")
79-
80- echo "### What's changed in the VS Code extension:" > release_notes.md
81- echo "" >> release_notes.md
82-
83- if [ -n "$PREV_TAG" ]; then
84- git log ${PREV_TAG}..HEAD --pretty=format:"* %s (%h)" -- apps/editor packages/ui/src/components/editor >> release_notes.md
85- else
86- git log --pretty=format:"* %s (%h)" -- apps/editor packages/ui/src/components/editor >> release_notes.md
87- fi
88-
8981 - name : Create Release
90- if : steps.check_tag.outputs.exists == 'false'
91- uses : softprops/action-gh-release@v2
82+ uses : ./.github/actions/create-app-release
9283 with :
93- tag_name : ${{ steps.package_version.outputs.version }}
94- name : ${{ steps.package_version.outputs.raw_version }} - VS Code
95- body_path : release_notes.md
96- target_commitish : ${{ github.sha }}
84+ app_name : ' VS Code '
85+ app_suffix : ' vscode '
86+ version : ${{ steps.package_version.outputs.raw_version }}
87+ changelog_paths : ' apps/editor packages/ui/src/components/editor '
9788
9889 release-browser :
99- needs : check
90+ needs : [check, changes]
91+ if : needs.changes.outputs.browser == 'true'
10092 runs-on : ubuntu-latest
10193
10294 steps :
@@ -110,38 +102,12 @@ jobs:
110102 id : browser_version
111103 run : |
112104 VERSION=$(jq -r .version apps/browser/src/manifest.json)
113- echo "version=$VERSION-browser" >> $GITHUB_OUTPUT
114105 echo "raw_version=$VERSION" >> $GITHUB_OUTPUT
115106
116- - name : Check if tag exists
117- id : check_tag
118- run : |
119- # Prevent failing if manifest.json was modified but version wasn't bumped
120- if git ls-remote --tags origin refs/tags/${{ steps.browser_version.outputs.version }} | grep -q 'refs/tags/'; then
121- echo "exists=true" >> $GITHUB_OUTPUT
122- else
123- echo "exists=false" >> $GITHUB_OUTPUT
124- fi
125-
126- - name : Generate Release Notes
127- if : steps.check_tag.outputs.exists == 'false'
128- run : |
129- PREV_TAG=$(git describe --tags --match "*-browser" --abbrev=0 2>/dev/null || echo "")
130-
131- echo "### What's changed in the browser extension:" > release_notes_browser.md
132- echo "" >> release_notes_browser.md
133-
134- if [ -n "$PREV_TAG" ]; then
135- git log ${PREV_TAG}..HEAD --pretty=format:"* %s (%h)" -- apps/browser packages/shared/src/constants/chatbots.ts packages/ui/src/components/browser >> release_notes_browser.md
136- else
137- git log --pretty=format:"* %s (%h)" -- apps/browser packages/shared/src/constants/chatbots.ts packages/ui/src/components/browser >> release_notes_browser.md
138- fi
139-
140107 - name : Create Release
141- if : steps.check_tag.outputs.exists == 'false'
142- uses : softprops/action-gh-release@v2
108+ uses : ./.github/actions/create-app-release
143109 with :
144- tag_name : ${{ steps.browser_version.outputs.version }}
145- name : ${{ steps.browser_version.outputs.raw_version }} - Browser
146- body_path : release_notes_browser.md
147- target_commitish : ${{ github.sha }}
110+ app_name : ' Browser '
111+ app_suffix : ' browser '
112+ version : ${{ steps.browser_version.outputs.raw_version }}
113+ changelog_paths : ' apps/browser packages/shared/src/constants/chatbots.ts packages/ui/src/components/browser '
0 commit comments