Skip to content

Update repository URLs to CodeWebChat/CWC #47

Update repository URLs to CodeWebChat/CWC

Update repository URLs to CodeWebChat/CWC #47

name: Create GitHub Release
on:
push:
branches:
- main
paths:
- 'apps/editor/package.json'
- 'apps/browser/src/manifest.json'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Get version from package.json
id: package_version
run: |
VERSION=$(jq -r .version apps/editor/package.json)
echo "version=$VERSION-vscode" >> $GITHUB_OUTPUT
echo "raw_version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check_tag
run: |
# Prevent failing if package.json was modified but version wasn't bumped
if git ls-remote --tags origin refs/tags/${{ steps.package_version.outputs.version }} | grep -q 'refs/tags/'; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Generate Release Notes
if: steps.check_tag.outputs.exists == 'false'
run: |
PREV_TAG=$(git describe --tags --match "*-vscode" --abbrev=0 2>/dev/null || echo "")
echo "### What's changed in the VS Code extension:" > release_notes.md
echo "" >> release_notes.md
if [ -n "$PREV_TAG" ]; then
git log ${PREV_TAG}..HEAD --pretty=format:"* %s (%h)" -- apps/editor packages/ui/src/components/editor >> release_notes.md
else
git log --pretty=format:"* %s (%h)" -- apps/editor packages/ui/src/components/editor >> release_notes.md
fi
- name: Create Release
if: steps.check_tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.package_version.outputs.version }}
name: ${{ steps.package_version.outputs.raw_version }} - VS Code
body_path: release_notes.md
target_commitish: ${{ github.sha }}
release-browser:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Get version from manifest.json
id: browser_version
run: |
VERSION=$(jq -r .version apps/browser/src/manifest.json)
echo "version=$VERSION-browser" >> $GITHUB_OUTPUT
echo "raw_version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check_tag
run: |
# Prevent failing if manifest.json was modified but version wasn't bumped
if git ls-remote --tags origin refs/tags/${{ steps.browser_version.outputs.version }} | grep -q 'refs/tags/'; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Generate Release Notes
if: steps.check_tag.outputs.exists == 'false'
run: |
PREV_TAG=$(git describe --tags --match "*-browser" --abbrev=0 2>/dev/null || echo "")
echo "### What's changed in the browser extension:" > release_notes_browser.md
echo "" >> release_notes_browser.md
if [ -n "$PREV_TAG" ]; then
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
else
git log --pretty=format:"* %s (%h)" -- apps/browser packages/shared/src/constants/chatbots.ts packages/ui/src/components/browser >> release_notes_browser.md
fi
- name: Create Release
if: steps.check_tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.browser_version.outputs.version }}
name: ${{ steps.browser_version.outputs.raw_version }} - Browser
body_path: release_notes_browser.md
target_commitish: ${{ github.sha }}