Skip to content

Commit

Permalink
wip: changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Oct 24, 2023
1 parent 4ff6517 commit b283c3c
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "wagmi-dev/vocs"
}
],
"commit": false,
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
},
"ignore": ["playgrounds-*"]
}
5 changes: 5 additions & 0 deletions .changeset/metal-pets-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vocs": minor
---

Initial release
8 changes: 8 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"vocs": "0.0.0"
},
"changesets": []
}
63 changes: 63 additions & 0 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Changesets
on:
push:
branches: main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit

changesets:
name: Create version pull request
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Create Version Pull Request
uses: changesets/action@v1
with:
commit: 'chore: version package'
title: 'chore: version package'
version: bun run changeset:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
name: Release
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Publish to NPM
uses: changesets/action@v1
with:
createGithubReleases: ${{ github.ref == 'refs/heads/main' }}
publish: bun run changeset:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# https://docs.npmjs.com/generating-provenance-statements
NPM_CONFIG_PROVENANCE: true
Binary file modified bun.lockb
Binary file not shown.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"type": "module",
"scripts": {
"build": "rimraf src/_lib src/tsconfig.build.* && tsc -p tsconfig.build.json && bun scripts/postbuild.ts",
"changeset": "changeset",
"changeset:publish": "bun run build && changeset publish",
"changeset:version": "changeset version && bun install --lockfile-only && bun scripts/postversion.ts",
"docs:dev": "cd site && bun run dev",
"docs:build": "cd site && bun run build",
"format": "biome format . --write",
Expand All @@ -22,6 +25,8 @@
"@types/react-helmet": "^6.1.7",
"@types/serve-static": "^1.15.3",
"bun-types": "^1.0.6",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"fs-extra": "^11.1.1",
"rimraf": "^5.0.5",
"simple-git-hooks": "^2.9.0",
Expand Down
8 changes: 8 additions & 0 deletions scripts/postversion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { join } from 'node:path'

// Writes the current package.json version to `./src/cli/version.ts`.
const versionFilePath = join(import.meta.dir, '../src/cli/version.ts')
const packageJsonPath = join(import.meta.dir, '../src/package.json')
const packageVersion = (await Bun.file(packageJsonPath).json()).version

Bun.write(versionFilePath, `export const version = '${packageVersion}'\n`)

0 comments on commit b283c3c

Please sign in to comment.