Skip to content

Commit

Permalink
Set up release pipeline
Browse files Browse the repository at this point in the history
Using changesets for the release pipeline. Pretty commonly used for
publishing npm packages.
  • Loading branch information
petter committed Feb 28, 2024
1 parent a9c3127 commit 8d15ff8
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Bun
uses: oven-sh/setup-bun@v1

- name: Install Dependencies
run: bun install

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: bun release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# - name: Send a Slack notification if a publish happens
# if: steps.changesets.outputs.published == 'true'
# # You can do something when a publish happens.
# run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!"
Binary file modified bun.lockb
Binary file not shown.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "bunx tsc",
"prepublishOnly": "bun run build",
"changeset": "changeset",
"prerelease": "bun run build",
"release": "changeset publish",
"format:check": "prettier --check ."
},
"files": [
Expand All @@ -20,6 +22,7 @@
"bugs": "https://github.com/wobsoriano/pkg-name/issues",
"author": "Christoffer Bjelke",
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@types/bun": "latest",
"@types/react": "^18.2.57",
"@types/react-dom": "^18.2.19",
Expand All @@ -30,5 +33,8 @@
},
"peerDependencies": {
"react-dom": "^18.2.0"
},
"publishConfig": {
"provenance": true
}
}

0 comments on commit 8d15ff8

Please sign in to comment.