-
Notifications
You must be signed in to change notification settings - Fork 64
88 lines (76 loc) · 2.38 KB
/
release.yml
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
86
87
88
name: Release
on:
push:
branches:
- master
- next
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ACTIONS_RUNNER_DEBUG: true
NEXT_TELEMETRY_DISABLED: '1'
ASTRO_TELEMETRY_DISABLED: '1'
NODE_OPTIONS: '--no-warnings'
FORCE_COLOR: 1
jobs:
release:
name: 'Release'
if: github.repository == 'rehype-pretty/rehype-pretty-code' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ['ubuntu-latest']
permissions:
issues: write
contents: write
id-token: write
packages: write
pull-requests: write
repository-projects: write
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Get pnpm Version'
id: pnpm-version
run: |
PNPM_VERSION=$(cat package.json | jq --raw-output '.packageManager' | awk -F'@' '{print $2}')
echo "PNPM_VERSION=$PNPM_VERSION" >> $GITHUB_OUTPUT
- name: 'Setup pnpm'
uses: pnpm/action-setup@v3
with:
version: ${{ steps.pnpm-version.outputs.PNPM_VERSION }}
- name: 'Setup Node.js'
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
- name: 'Install Dependencies'
run: pnpm install --frozen-lockfile
- name: Check for unreleased changesets
id: has-changesets
uses: andstor/file-existence-action@v3
with:
files: ".changeset/!(README).md"
- name: 'Build Packages'
if: steps.has-changesets.outputs.files_exists == 'true'
run: |
pnpm lint && pnpm format
pnpm typecheck
pnpm test
pnpm build
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
# Note: pnpm install after versioning is necessary to refresh lockfile
version: pnpm dlx bun@latest ./scripts/changeset-update-version.ts
publish: pnpm exec changeset publish
commit: "[ci] release"
title: "[ci] release"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}