-
-
Notifications
You must be signed in to change notification settings - Fork 241
73 lines (61 loc) · 2.54 KB
/
publish.yml
File metadata and controls
73 lines (61 loc) · 2.54 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
name: Publish Package
on:
push:
tags:
- 'plugin-*'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write # for ArnaudBarre/github-release to create a release
id-token: write # for provenance generation
environment: Release
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@078e9d416474b29c0c387560859308974f7e9c53 # v6.0.1
- name: Set node version
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://registry.npmjs.org/
# disable cache, to avoid cache poisoning (https://docs.zizmor.sh/audits/#cache-poisoning)
package-manager-cache: false
- name: Disallow installation scripts
run: yq '.onlyBuiltDependencies = []' -i pnpm-workspace.yaml
- name: Install deps
run: pnpm install
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
- name: Get pkgName for tag
id: tag
run: |
# Check if the tag contains "alpha"
if [[ $GITHUB_REF_NAME =~ alpha ]]; then
echo "isAlpha=true" >> $GITHUB_OUTPUT
else
echo "isAlpha=false" >> $GITHUB_OUTPUT
fi
# `%@*` truncates @ and version number from the right side.
# https://stackoverflow.com/questions/9532654/expression-after-last-specific-character
pkgName=${GITHUB_REF_NAME%@*}
echo "pkgName=$pkgName" >> $GITHUB_OUTPUT
- if: steps.tag.outputs.pkgName == 'plugin-react-swc'
working-directory: packages/plugin-react-swc
run: pnpm build
- name: Publish package
run: npm i -g npm@^11.5.2 && pnpm run ci-publish ${{ github.ref_name }}
- if: steps.tag.outputs.isAlpha == 'false' && steps.tag.outputs.pkgName != 'plugin-rsc'
uses: ArnaudBarre/github-release@4fa6eafe8e2449c7c1c5a91ae50de4ee34db0b40 # v1.5.0
with:
path: packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md
tag-name: ${{ github.ref_name }}
- if: steps.tag.outputs.isAlpha == 'false' && steps.tag.outputs.pkgName == 'plugin-rsc'
uses: yyx990803/release-tag@8cccf7c5aa332d71d222df46677f70f77a8d2dc0 # v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body: |
Please refer to [CHANGELOG.md](https://github.com/vitejs/vite-plugin-react/blob/${{ github.ref_name }}/packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md) for details.