forked from nicojs/typed-html
-
-
Notifications
You must be signed in to change notification settings - Fork 36
85 lines (70 loc) · 2.27 KB
/
release.yml
File metadata and controls
85 lines (70 loc) · 2.27 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Release Flow
on:
push:
branches: [master, next]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
id-token: write # Required for OIDC
contents: write
pull-requests: write # Required to create a release PR
checks: write # Required to create a check run
issues: write # Required to create issues
jobs:
release:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
environment:
name: NPM Registry
steps:
- name: Checkout
uses: actions/checkout@v6
# https://github.com/actions/checkout/issues/1471
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup node and restore cached dependencies
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install packages
run: pnpm install --frozen-lockfile
- name: Cache turbo build setup
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Build
run: pnpm build
- name: Resolve publish tag
id: publish-tag
uses: actions/github-script@v8
with:
result-encoding: string
script: |
const fs = require('fs');
try {
return JSON.parse(fs.readFileSync('.changeset/pre.json', 'utf8')).tag;
} catch {
return 'latest';
}
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
version: pnpm ci-version
commit: 'chore: update versions'
title: 'Release plan'
# https://github.com/changesets/action/issues/246
# https://github.com/changesets/changesets/pull/674
publish: pnpm ci-publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
PUBLISH_TAG: ${{ steps.publish-tag.outputs.result }}
PUBLISH_BRANCH: ${{ github.ref_name }}