Skip to content

Bump version to 1.9.7 #72

Bump version to 1.9.7

Bump version to 1.9.7 #72

Workflow file for this run

name: Create Release and Publish to Marketplace
on:
push:
tags:
- 'v*'
permissions:
contents: write
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Set API Key
run: |
echo "export const AMPLITUDE_API_KEY = '${{ secrets.AMPLITUDE_API_KEY }}';" > src/constants/apiKeys.ts
- name: Build
run: npm run compile
- name: Package Extension
run: npm run package
- name: Get version from package.json
id: get_version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Generate Release Notes
id: release_notes
run: |
LATEST_TAG=$(git describe --tags --abbrev=0)
SECOND_LATEST_TAG=$(git describe --tags --abbrev=0 $LATEST_TAG^)
# Получаем список изменений и очищаем его
CHANGES=$(git log $SECOND_LATEST_TAG..$LATEST_TAG --pretty=format:"- %s")
# Удаляем экранированные переносы строк и "Changes:"
CLEAN_CHANGES=$(echo "$CHANGES" | sed 's/\\n/\n/g' | sed 's/^Changes://g')
# Определяем тип релиза
if echo "$CLEAN_CHANGES" | grep -q "security patch release"; then
PREFIX="*🔒 Security Update!*"
RELEASE_NOTE="This release contains important security updates."
else
PREFIX="*🚀 New Release!*"
RELEASE_NOTE=""
fi
# Формируем финальное сообщение для Telegram
cat << EOF > telegram_message.txt
$PREFIX
GeminiCommit _${LATEST_TAG}_
Changes:
$CLEAN_CHANGES
[Download from Marketplace](https://marketplace.visualstudio.com/items?itemName=VizzleTF.geminicommit)
Join our [community chat](https://t.me/gemini_commit) for discussions and support!
#vscode #geminicommit #update #git #ai #gemini #developer #tools #llm
EOF
echo "TELEGRAM_MSG<<EOF" >> $GITHUB_OUTPUT
cat telegram_message.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
if [ -n "$RELEASE_NOTE" ]; then
echo "NOTES<<EOF" >> $GITHUB_OUTPUT
echo "$RELEASE_NOTE" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "Changes:" >> $GITHUB_OUTPUT
echo "$CLEAN_CHANGES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "NOTES<<EOF" >> $GITHUB_OUTPUT
echo "Changes:" >> $GITHUB_OUTPUT
echo "$CLEAN_CHANGES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const { repo: { owner, repo }, sha } = context;
const tag = context.ref.substring(10); // remove 'refs/tags/'
console.log(`Creating release for version ${process.env.VERSION}`);
const release = await github.rest.repos.createRelease({
owner,
repo,
tag_name: tag,
name: `Release ${tag}`,
body: `${{ steps.release_notes.outputs.NOTES }}`,
draft: false,
prerelease: false
});
const vsixFile = `geminicommit-${process.env.VERSION}.vsix`;
console.log(`Looking for file: ${vsixFile}`);
if (fs.existsSync(vsixFile)) {
const asset = await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: release.data.id,
name: vsixFile,
data: fs.readFileSync(vsixFile)
});
console.log(`Asset uploaded: ${asset.data.browser_download_url}`);
} else {
console.error(`File not found: ${vsixFile}`);
core.setFailed(`VSIX file not found: ${vsixFile}`);
}
- name: Publish to Visual Studio Marketplace
env:
VSCE_PAT: ${{ secrets.VS_MARKETPLACE_TOKEN }}
run: npx vsce publish -p $VSCE_PAT
- name: Send Telegram Notification
if: success()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
format: markdown
message_file: telegram_message.txt
- name: Notify on Security Release
if: ${{ contains(steps.release_notes.outputs.NOTES, '🔒 Security Patch Release') }}
uses: actions/github-script@v7
with:
script: |
const issue = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Security Release v${process.env.VERSION} Published`,
body: `A new security patch release v${process.env.VERSION} has been published to address critical vulnerabilities.
Release Notes:
${{ steps.release_notes.outputs.NOTES }}
The extension has been automatically updated in the Visual Studio Marketplace.`,
labels: ['security']
});