forked from vitejs/vite
-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (41 loc) · 1.61 KB
/
release-tag.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
name: Add GitHub Release Tag
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
- "plugin-*" # Push events to matching plugin-*, i.e. plugin-(vue|vue-jsx|react|legacy)@1.0.0
- "create-vite*" # # Push events to matching create-vite*, i.e. [email protected]
# $GITHUB_REF_NAME - https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
jobs:
release:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get pkgName for tag
id: tag
run: |
# skip if alpha
if [[ $GITHUB_REF_NAME =~ alpha ]]; then
exit 0
fi
# matching v2.0.0 / v2.0.0-beta.8 etc
if [[ $GITHUB_REF_NAME =~ ^v.+ ]]; then
pkgName="vite"
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 "pkgName=$pkgName" >> $GITHUB_OUTPUT
- name: Create Release for Tag
# only run if tag is not alpha
if: steps.tag.outputs.pkgName
id: release_tag
uses: yyx990803/release-tag@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body: |
Please refer to [CHANGELOG.md](https://github.com/vitejs/vite/blob/${{ github.ref_name }}/packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md) for details.