From c35b3ad8e7dff6bbcf9baa82a64e2d211719b625 Mon Sep 17 00:00:00 2001 From: Andrea Carraro Date: Sun, 27 Oct 2024 14:09:58 +0100 Subject: [PATCH] ci: tag with changesets --- .github/workflows/release.yml | 2 +- package.json | 1 - scripts/tag.js | 19 ------------------- 3 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 scripts/tag.js diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a19443a..3c97aef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,6 @@ jobs: - name: Create release pull request uses: changesets/action@v1 with: - publish: npm run tag + publish: npx changeset tag env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} diff --git a/package.json b/package.json index 7f3ca2c..e57db55 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "pretest": "npm run test:build", "test:build": "npm --prefix ./examples/fastify-integration-plugin run generate-schemas", "prepare": "npx simple-git-hooks && npm run test -- --run && npm run source:check && npm run build", - "tag": "node ./scripts/tag.js", "prettier:check": "prettier . --check", "prettier:fix": "npm run prettier:check -- --write", "type:check": "tsc --noEmit", diff --git a/scripts/tag.js b/scripts/tag.js deleted file mode 100644 index fd85b17..0000000 --- a/scripts/tag.js +++ /dev/null @@ -1,19 +0,0 @@ -const util = require('node:util'); -const exec = util.promisify(require('node:child_process').exec); -const { version } = require('../package.json'); - -async function tag() { - const currentVersion = `v${version}`; - await exec('git fetch --all --tags'); - const gitTagResponse = await exec('git tag'); - const existingTags = gitTagResponse.stdout.split('\n'); - - if (existingTags.includes(currentVersion)) { - console.log(`Tag ${currentVersion} already exists`); - return; - } - - await exec(`git tag v${version}`); - await exec('git push --tags'); -} -tag();