-
Notifications
You must be signed in to change notification settings - Fork 188
105 lines (91 loc) · 2.82 KB
/
release.yaml
File metadata and controls
105 lines (91 loc) · 2.82 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag (beta or latest)'
required: true
default: 'latest'
type: choice
options:
- latest
- beta
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
npm i -g pnpm
rm -rf ~/.npm/_cacache
rm -rf node_modules/.cache
rm -rf packages/core/node_modules
pnpm store prune || true
pnpm install --force
- name: Build
run: |
(cd packages/core && \
pnpm run aeac && \
pnpm run build:es && \
pnpm run build:umd)
- name: Determine release tag
id: tag_type
run: |
VERSION=$(node -p "require('./packages/core/package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
if [[ "$VERSION" == *"beta"* ]] || [[ "${{ github.event.inputs.tag }}" == "beta" ]]; then
echo "TAG=beta" >> $GITHUB_OUTPUT
else
echo "TAG=latest" >> $GITHUB_OUTPUT
fi
- name: Create .tgz package
run: |
cd packages/core
npm pack
- name: Publish to npm
if: github.event_name == 'push' || github.event.inputs.tag
run: |
cd packages/core
npm publish --tag ${{ steps.tag_type.outputs.TAG }} --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: npm-package
path: packages/core/vue-element-plus-x-${{ steps.tag_type.outputs.VERSION }}.tgz
retention-days: 90
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: packages/core/vue-element-plus-x-${{ steps.tag_type.outputs.VERSION }}.tgz
body_path: packages/core/CHANGELOG.md
draft: false
prerelease: ${{ steps.tag_type.outputs.TAG == 'beta' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release Pull Request
id: create_release
uses: changesets/action@v1
with:
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}