diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15b5b19..2343031 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,5 +31,7 @@ jobs: - name: Create Release Pull Request uses: changesets/action@v1 + with: + publish: npm run dummy-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index a7a52a2..e9d1ea8 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,8 @@ "format:check": "prettier --cache --check .", "postinstall": "npm run download-uroborosql-fmt-napi && cd client && npm install && cd ../server && npm install && cd ..", "test": "sh ./scripts/e2e.sh", - "download-uroborosql-fmt-napi": "node ./server/download-uroborosql-fmt-napi.mjs" + "download-uroborosql-fmt-napi": "node ./server/download-uroborosql-fmt-napi.mjs", + "dummy-release": "node ./scripts/dummy-publish.mjs" }, "devDependencies": { "@changesets/changelog-github": "^0.4.8", diff --git a/scripts/dummy-publish.mjs b/scripts/dummy-publish.mjs new file mode 100644 index 0000000..965de51 --- /dev/null +++ b/scripts/dummy-publish.mjs @@ -0,0 +1,19 @@ +import { readFileSync } from "node:fs"; +import * as cp from "child_process"; + +main(); + +// 既に作成済みのバージョンのtagを再度作成しようとしてgithub actionが失敗するのを防ぐため +// tag作成が必要な場合のみ"New tag:"を出力する +function main() { + cp.execSync("git fetch --tags origin"); + + const tags = cp.execSync("git tag").toString().split("\n"); + const changelog = readFileSync("CHANGELOG.md", "utf8"); + + const latestVersion = changelog.match(/^## (?\d\.\d\.\d)/m); + + if (!tags.includes(`v${latestVersion.groups.version}`)) { + console.log('"New tag:"'); + } +}