Skip to content

Commit

Permalink
ci(changeset): add pnpm bump script (#20)
Browse files Browse the repository at this point in the history
* ci(changeset): add `pnpm bump` script

* chore(changeset): add changeset
  • Loading branch information
fu050409 authored Jul 13, 2024
1 parent 92565b4 commit 328cf8c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .changeset/large-shrimps-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ jobs:
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: pnpm bump
title: "chore(release): version packages"
commit: "chore(release): version packages"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"tauri": "tauri"
"tauri": "tauri",
"bump": "node scripts/bump.mjs"
},
"dependencies": {
"@primevue/themes": "^4.0.0",
Expand Down
34 changes: 34 additions & 0 deletions scripts/bump.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { execSync } from 'child_process';
import { readFileSync, writeFileSync } from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

execSync('npx changeset version', { stdio: 'inherit' });
execSync('pnpm install --no-frozen-lockfile', { stdio: 'inherit' });

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const cargoFilePath = path.join(__dirname, '../src-tauri/Cargo.toml');
const nodeFilePath = path.join(__dirname, '../src-tauri/package.json');
const workspaceFilePath = path.join(__dirname, '../package.json');

const cargoData = readFileSync(cargoFilePath, 'utf8');
const nodeData = readFileSync(nodeFilePath, 'utf8');
const workspaceData = readFileSync(workspaceFilePath, 'utf8');

const newVersion = JSON.parse(workspaceData).version;
const newCargoVersion = JSON.parse(nodeData).version;
const updatedData = cargoData.replace(
/version = ".*"/,
`version = "${newCargoVersion}"`
);

writeFileSync(cargoFilePath, updatedData, 'utf8');

// const nodeChangelogFilePath = path.join(__dirname, '../CHANGELOG.md');
// const nodeChangelogData = readFileSync(nodeChangelogFilePath, 'utf8');
// const cargoChangeLogFilePath = path.join(
// __dirname,
// '../src-tauri/CHANGELOG.md'
// );
// const cargoChangeLogData = readFileSync(cargoChangeLogFilePath, 'utf8');

0 comments on commit 328cf8c

Please sign in to comment.