-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (51 loc) · 1.65 KB
/
release.yml
File metadata and controls
53 lines (51 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Release
on:
push:
branches: [main]
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write # Required for OIDC
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run build
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Create Release PR or Detect Publishable Versions
id: changesets
uses: changesets/action@v1
with:
version: bun run changeset:version
commit: "chore: release"
title: "chore: release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm
if: steps.changesets.outputs.hasChangesets == 'false'
working-directory: packages/classy-store
run: |
npm install -g npm@latest
PKG_NAME=$(node -p "require('./package.json').name")
PKG_VERSION=$(node -p "require('./package.json').version")
if npm view "${PKG_NAME}@${PKG_VERSION}" version 2>/dev/null; then
echo "Version ${PKG_VERSION} already published — skipping."
else
npm publish --provenance --access public
fi
- name: Create git tags
if: steps.changesets.outputs.hasChangesets == 'false'
run: |
bunx changeset tag
git push --follow-tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}