diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 13dcd22b..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Release Obsidian Plugin - -on: - push: - tags: - - "*" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: "18.x" - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - - name: Install dependencies - run: pnpm install - - - name: Build plugin - run: pnpm --filter "./packages/plugin" build - - - name: Get plugin version - id: version - run: | - version=$(node -p "require('./packages/plugin/manifest.json').version") - echo "version=$version" >> $GITHUB_OUTPUT - - - name: Create Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Create a temporary directory for release files - mkdir release - cp packages/plugin/dist/main.js release/ - cp packages/plugin/dist/styles.css release/ - cp packages/plugin/manifest.json release/ - - # Create release notes from git log - git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 HEAD^)..HEAD > release/notes.md - - # Create the release - gh release create "${{ steps.version.outputs.version }}" \ - --title="Version ${{ steps.version.outputs.version }}" \ - --notes-file=release/notes.md \ - --draft=false \ - release/main.js \ - release/styles.css \ - release/manifest.json \ No newline at end of file diff --git a/packages/plugin/commit.js b/packages/plugin/commit.js deleted file mode 100644 index 55bd0737..00000000 --- a/packages/plugin/commit.js +++ /dev/null @@ -1,24 +0,0 @@ -const fs = require('fs'); -const { exec } = require('child_process'); - -// Read manifest.json -fs.readFile('manifest.json', 'utf8', (err, data) => { - if (err) { - console.error(`Error reading file: ${err}`); - return; - } - - // Parse JSON - const manifest = JSON.parse(data); - const version = manifest.version; - - // Create git tag and push - exec(`git tag -a ${version} -m "${version}" && git push origin ${version}`, (err, stdout, stderr) => { - if (err) { - console.error(`Error executing git commands: ${err}`); - return; - } - - console.log(`Tag ${version} created and pushed successfully.`); - }); -}); \ No newline at end of file diff --git a/release.js b/release.js deleted file mode 100644 index e50c2d1d..00000000 --- a/release.js +++ /dev/null @@ -1,81 +0,0 @@ -const { execSync } = require('child_process'); -const readline = require('readline'); -const fs = require('fs'); - -const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout -}); - -function executeCommand(command) { - try { - return execSync(command, { encoding: 'utf8' }); - } catch (error) { - console.error(`Error executing command: ${command}`); - console.error(error.message); - process.exit(1); - } -} - -function updatePackageVersion(version) { - const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); - packageJson.version = version; - fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2)); -} - -function updateVersionFiles() { - executeCommand('node version-bump.mjs'); -} - -async function release() { - // Get current version - const currentVersion = JSON.parse(fs.readFileSync('package.json', 'utf8')).version; - console.log(`Current version: ${currentVersion}`); - - // Prompt for new version - const newVersion = await new Promise(resolve => { - rl.question('Enter new version number: ', resolve); - }); - - // Prompt for release description - const description = await new Promise(resolve => { - rl.question('Enter release description: ', resolve); - }); - - // Update package.json - updatePackageVersion(newVersion); - - // Run version-bump.mjs - updateVersionFiles(); - - // Build the plugin - executeCommand('npm run build'); - - // Git commands - executeCommand('git add .'); - executeCommand(`git commit -m "Release ${newVersion}: ${description}"`); - executeCommand(`git tag -a ${newVersion} -m "${description}"`); - executeCommand('git push'); - executeCommand(`git push origin ${newVersion}`); - - // Create source code archives - executeCommand('git archive --format=zip HEAD > source-code.zip'); - executeCommand('git archive --format=tar.gz HEAD > source-code.tar.gz'); - - // Create GitHub release - const releaseCommand = `gh release create ${newVersion} \ - --title "${newVersion}" \ - --notes "${description}" \ - main.js manifest.json styles.css source-code.zip source-code.tar.gz`; - - executeCommand(releaseCommand); - - // Clean up temporary files - fs.unlinkSync('source-code.zip'); - fs.unlinkSync('source-code.tar.gz'); - - console.log(`Version ${newVersion} has been released!`); - rl.close(); -} - -release(); \ No newline at end of file