diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 63b5cfd..91b5079 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,9 @@ name: Release +permissions: + contents: write + actions: read + on: push: tags: @@ -96,27 +100,12 @@ jobs: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT fi - - name: Create Release + - name: Create Draft Release run: | gh release create ${{ steps.tag.outputs.tag }} \ --title "FriendlyKobold ${{ steps.tag.outputs.tag }}" \ - --notes "## What's New - - Release ${{ steps.tag.outputs.tag }} of FriendlyKobold - - ### Downloads - - **macOS**: Download the \`.dmg\` file - - **Windows**: Download the \`.exe\` installer - - **Linux**: Download the \`.AppImage\` file - - ### Installation - - **macOS**: Open the \`.dmg\` file and drag FriendlyKobold to Applications - - **Windows**: Run the \`.exe\` installer - - **Linux**: Make the \`.AppImage\` executable and run it - - --- - - For more information, visit our [repository](https://github.com/${{ github.repository }})." + --draft \ + --generate-notes env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 343435d..79db6d8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "friendly-kobold", "productName": "Friendly Kobold", - "version": "0.2.0", + "version": "0.3.0", "description": "A modern Electron shell for KoboldCpp", "main": "out/main/index.js", "homepage": "./", @@ -26,6 +26,7 @@ "spell-check": "cspell \"**/*.{ts,tsx,js,jsx,md,json}\" --no-progress", "spell-check:fix": "cspell \"**/*.{ts,tsx,js,jsx,md,json}\" --no-progress --show-suggestions", "check-all": "yarn lint && yarn compile && yarn spell-check", + "release": "node scripts/release.js", "prepare": "husky" }, "lint-staged": { diff --git a/scripts/release.js b/scripts/release.js new file mode 100644 index 0000000..13f14c3 --- /dev/null +++ b/scripts/release.js @@ -0,0 +1,45 @@ +#!/usr/bin/env node + +const { execSync } = require('child_process'); +const fs = require('fs'); +const path = require('path'); + +// Read package.json to get current version +const packageJson = JSON.parse( + fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8') +); +const currentVersion = packageJson.version; + +console.log(`Creating release for version ${currentVersion}...`); + +try { + // Check if we're in a git repository + execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' }); + + // Check if there are uncommitted changes + const gitStatus = execSync('git status --porcelain', { encoding: 'utf8' }); + if (gitStatus.trim() !== '') { + console.error( + 'Error: There are uncommitted changes. Please commit or stash them before creating a release.' + ); + process.exit(1); + } + + // Create and push the tag + const tagName = `v${currentVersion}`; + console.log(`Creating tag ${tagName}...`); + + execSync(`git tag ${tagName}`, { stdio: 'inherit' }); + console.log(`Pushing tag ${tagName}...`); + + execSync(`git push origin ${tagName}`, { stdio: 'inherit' }); + + console.log(`✅ Release ${tagName} created successfully!`); + console.log(`📦 GitHub Actions will now build and publish the release.`); + console.log( + `🔗 Check the progress at: https://github.com/lone-cloud/friendly-kobold/actions` + ); +} catch (error) { + console.error('❌ Error creating release:', error.message); + process.exit(1); +}