forked from lisonge/vite-plugin-monkey
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.44 KB
/
publish-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
name: Publish Package + Create Release
on:
push:
tags:
- 'v*'
- 'create-monkey*'
jobs:
publish_release:
# prevents this action from running on forks
if: github.repository == 'lisonge/vite-plugin-monkey'
runs-on: ubuntu-latest
environment: Release
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v3
- uses: pnpm/action-setup@v2
- run: pnpm install
- run: pnpm build
- name: Publish package
run: |
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
pnpm run ci-publish ${{ github.ref_name }}
- name: Get pkgName for tag
id: tag
run: |
# matching v2.0.0 / v2.0.0-beta.8 etc
if [[ $GITHUB_REF_NAME =~ ^v.+ ]]; then
pkgName="vite-plugin-monkey"
else
# `%@*` truncates @ and version number from the right side.
# https://stackoverflow.com/questions/9532654/expression-after-last-specific-character
pkgName=${GITHUB_REF_NAME%@*}
fi
echo "::set-output name=pkgName::$pkgName"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: ./packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md