Skip to content

Commit

Permalink
ci: drop changesets, use manual triggered version release
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Sep 5, 2024
1 parent fcbb687 commit 5179e57
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
11 changes: 11 additions & 0 deletions .changeset/commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const getVersionMessage = async (releasePlan) => {
const publishableReleases = releasePlan.releases.filter(
(release) => release.type !== 'none',
)

const newVersion = publishableReleases[0].newVersion

return `v${newVersion}`
}

module.exports = { getVersionMessage }
4 changes: 2 additions & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"changelog": false,
"commit": "./commit.js",
"fixed": [],
"linked": [],
"access": "public",
Expand Down
38 changes: 22 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Release

on:
push:
branches:
- main
permissions:
contents: write

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
on: workflow_dispatch

jobs:
release:
Expand All @@ -30,10 +27,10 @@ jobs:
# https://github.com/changesets/action/issues/98#issuecomment-917292485
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc

- name: Install Dependencies
- name: Install dependencies
run: pnpm i

- name: Prepare for Release
- name: Prepare for release
run: |
pnpm run format
pnpm run lint
Expand All @@ -42,13 +39,22 @@ jobs:
pnpm run build
pnpm run publint
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
- uses: actions/github-script@v7
id: version_to_release
with:
title: 'chore: next release'
publish: pnpm release
commit: 'release: publish'
result-encoding: string
script: |
const fs = require('fs');
const packageJson = JSON.parse(fs.readFileSync('./packages/vite-plugin-checker/package.json', 'utf8'));
return packageJson.version;
- name: Publish to NPM
run: |
git tag vite-plugin-checker@${{ steps.version_to_release.outputs.result }}
git push origin vite-plugin-checker@${{ steps.version_to_release.outputs.result }}
pnpm -r publish --no-git-checks
- name: GitHub release
run: pnpx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 5179e57

Please sign in to comment.