Skip to content

Commit 8cb79c9

Browse files
committed
feat: add github actions
1 parent de0012c commit 8cb79c9

File tree

14 files changed

+698
-1
lines changed

14 files changed

+698
-1
lines changed

.github/workflows/bug-server.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Bug Server CI
2+
3+
# 这里业务方根据需求设置
4+
on:
5+
push:
6+
branches: ['main']
7+
pull_request:
8+
branches: ['main', 'develop', 'dev/**']
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [18.x]
17+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
cache-dependency-path: './common/config/rush/pnpm-lock.yaml'
27+
28+
- name: Print All Github Environment Variables
29+
run: env
30+
31+
- name: Install rush
32+
run: node common/scripts/install-run-rush.js install --bypass-policy
33+
34+
- name: Build vutils-extension
35+
run: node common/scripts/install-run-rush.js build --only @visactor/vutils-extension
36+
37+
- name: Build VChart
38+
env:
39+
NODE_OPTIONS: '--max_old_space_size=4096'
40+
run: node common/scripts/install-run-rush.js run -p @visactor/vchart -s build:ci
41+
42+
- name: Run CI
43+
working-directory: ./packages/vchart
44+
env:
45+
BUG_SERVER_TOKEN: ${{ secrets.BUG_SERVER_TOKEN }}
46+
run: node ../../common/scripts/install-run-rushx.js ci

.github/workflows/hotfix-release.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: hotfix release CI
2+
3+
on:
4+
push:
5+
branches:
6+
- 'hotfix/[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
build:
10+
runs-on: macOS-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
strategy:
16+
matrix:
17+
node-version: [18.x]
18+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
- run: |
23+
git config user.name ${{ github.actor }}
24+
git config user.email ${{ github.actor }}@users.noreply.github.com
25+
26+
- name: Use Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: 'npm'
31+
cache-dependency-path: './common/config/rush/pnpm-lock.yaml'
32+
33+
# Install rush
34+
- name: Install rush
35+
run: node common/scripts/install-run-rush.js install --bypass-policy
36+
37+
- name: Parse semver version from branch name
38+
id: semver_parser
39+
uses: xile611/read-package-version-action@main
40+
with:
41+
path: packages/vchart
42+
semver_string: ${{ github.ref_name }}
43+
semver_pattern: '^hotfix/(.*)$' # ^v?(.*)$ by default
44+
45+
- name: update nextBump of version policies
46+
uses: xile611/set-next-bump-of-rush@main
47+
with:
48+
release_version: ${{ steps.semver_parser.outputs.full }}
49+
write_next_bump: true
50+
51+
- name: Update version
52+
run: node common/scripts/install-run-rush.js version --bump
53+
54+
- name: Build vutils-extension && vchart
55+
env:
56+
NODE_OPTIONS: '--max_old_space_size=4096'
57+
run: node common/scripts/install-run-rush.js build --to @visactor/vchart
58+
59+
# run bugserver after the build of main packages
60+
- name: Run Bugserver
61+
working-directory: ./packages/vchart
62+
env:
63+
BUG_SERVER_TOKEN: ${{ secrets.BUG_SERVER_TOKEN }}
64+
run: node ../../common/scripts/install-run-rushx.js ci
65+
66+
- name: Build react-vchart
67+
env:
68+
NODE_OPTIONS: '--max_old_space_size=4096'
69+
run: node common/scripts/install-run-rush.js build --only @visactor/react-vchart
70+
71+
- name: Build taro-vchart
72+
env:
73+
NODE_OPTIONS: '--max_old_space_size=4096'
74+
run: node common/scripts/install-run-rush.js build --only @visactor/taro-vchart
75+
76+
- name: Build lark-vchart
77+
env:
78+
NODE_OPTIONS: '--max_old_space_size=4096'
79+
run: node common/scripts/install-run-rush.js build --only @visactor/lark-vchart
80+
81+
- name: Build wx-vchart
82+
env:
83+
NODE_OPTIONS: '--max_old_space_size=4096'
84+
run: node common/scripts/install-run-rush.js build --only @visactor/wx-vchart
85+
86+
- name: Publish to npm
87+
env:
88+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
89+
NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
90+
run: node common/scripts/install-run-rush.js publish --publish --include-all --tag hotfix
91+
92+
- name: Update shrinkwrap
93+
run: node common/scripts/install-run-rush.js update
94+
95+
- name: Get npm version
96+
id: package-version
97+
uses: xile611/read-package-version-action@main
98+
with:
99+
path: packages/vchart
100+
101+
- name: Commit & Push changes
102+
run: |
103+
git add .
104+
git commit -m 'build: prelease version ${{ steps.package-version.outputs.current_version }}' -n
105+
git push origin ${{ github.ref_name }}
106+
107+
- name: Collect changelog of rush
108+
uses: xile611/collect-rush-changlog@main
109+
id: changelog
110+
with:
111+
version: ${{ steps.package-version.outputs.current_version }}
112+
113+
- name: Create Release for Tag
114+
id: release_tag
115+
uses: ncipollo/[email protected]
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
with:
119+
tag: v${{ steps.package-version.outputs.current_version }}
120+
commit: ${{ github.ref_name }}
121+
prerelease: false
122+
body: |
123+
${{ steps.changelog.outputs.markdown }}
124+
draft: true #

.github/workflows/label.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This workflow will triage pull requests and apply a label based on the
2+
# paths that are modified in the pull request.
3+
#
4+
# To use this workflow, you will need to set up a .github/labeler.yml
5+
# file with configuration. For more information, see:
6+
# https://github.com/actions/labeler
7+
8+
name: Labeler
9+
on: [pull_request_target]
10+
11+
jobs:
12+
label:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
steps:
19+
- uses: actions/labeler@v4
20+
with:
21+
repo-token: '${{ secrets.GITHUB_TOKEN }}'

.github/workflows/pr-check.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Check of pull request
2+
3+
# 这里业务方根据需求设置
4+
on:
5+
pull_request:
6+
branches: ['develop', 'dev/**']
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
node-version: [20.x]
14+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
cache: 'npm'
23+
cache-dependency-path: './common/config/rush/pnpm-lock.yaml'
24+
25+
- uses: xile611/pr-type-check@main
26+
with:
27+
pull_request_body: |
28+
${{ github.event.pull_request.body }}
29+
pull_request_head: ${{ github.event.pull_request.head.ref }}

.github/workflows/pre-release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Pre-release CI
2+
3+
on:
4+
push:
5+
branches:
6+
- 'pre-release/[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
7+
- 'pre-release/[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
8+
- 'pre-release/[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
9+
- 'pre-release/[0-9]+.[0-9]+.[0-9]+-hotfix.[0-9]+'
10+
11+
jobs:
12+
build:
13+
runs-on: macOS-latest
14+
15+
permissions:
16+
contents: write
17+
18+
strategy:
19+
matrix:
20+
node-version: [18.x]
21+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Use Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
cache: 'npm'
30+
cache-dependency-path: './common/config/rush/pnpm-lock.yaml'
31+
32+
# Install rush
33+
- name: Install rush
34+
run: node common/scripts/install-run-rush.js install --bypass-policy
35+
36+
- name: Parse semver version from branch name
37+
id: semver_parser
38+
uses: xile611/read-package-version-action@main
39+
with:
40+
path: packages/vchart
41+
semver_string: ${{ github.ref_name }}
42+
semver_pattern: '^pre-release/(.*)$' # ^v?(.*)$ by default
43+
44+
- name: Apply prereleaseName
45+
run: node common/scripts/apply-prerelease-version.js ${{ steps.semver_parser.outputs.pre_release_name }} ${{ steps.semver_parser.outputs.main }}
46+
47+
- name: Build packages
48+
env:
49+
NODE_OPTIONS: '--max_old_space_size=4096'
50+
run: node common/scripts/install-run-rush.js build --only tag:package
51+
52+
- name: Build lark-vchart
53+
env:
54+
NODE_OPTIONS: '--max_old_space_size=4096'
55+
run: node common/scripts/install-run-rush.js build --only @visactor/lark-vchart
56+
57+
- name: Build wx-vchart
58+
env:
59+
NODE_OPTIONS: '--max_old_space_size=4096'
60+
run: node common/scripts/install-run-rush.js build --only @visactor/wx-vchart
61+
62+
- name: Publish to npm
63+
env:
64+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
65+
NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
66+
run: node common/scripts/install-run-rush.js publish --publish --include-all --tag ${{ steps.semver_parser.outputs.pre_release_type }}
67+
68+
- name: Update shrinkwrap
69+
run: node common/scripts/install-run-rush.js update
70+
71+
- name: Get npm version
72+
id: package-version
73+
uses: xile611/read-package-version-action@main
74+
with:
75+
path: packages/vchart
76+
77+
- name: Commit & Push changes
78+
uses: actions-js/push@master
79+
with:
80+
github_token: ${{ secrets.GITHUB_TOKEN }}
81+
message: 'build: prelease version ${{ steps.package-version.outputs.current_version }}'
82+
branch: ${{ github.ref_name }}
83+
author_name: ${{ github.actor }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release changelog
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
update-changelog-after-publish-a-release:
9+
name: GitHub Actions Test
10+
runs-on: macOS-latest
11+
12+
strategy:
13+
matrix:
14+
node-version: [18.x]
15+
16+
steps:
17+
- name: Checkout
18+
id: checkout
19+
uses: actions/checkout@v3
20+
- run: |
21+
git config user.name ${{ github.actor }}
22+
git config user.email ${{ github.actor }}@users.noreply.github.com
23+
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
cache-dependency-path: './common/config/rush/pnpm-lock.yaml'
30+
31+
# Install rush
32+
- name: Install rush
33+
run: node common/scripts/install-run-rush.js install --bypass-policy
34+
35+
- name: Create branch
36+
run: |
37+
git status
38+
git fetch origin develop:develop
39+
git checkout develop
40+
git status
41+
git checkout -b docs/generate-changelog-${{ github.event.release.tag_name }}
42+
43+
- name: generate changelog
44+
id: generate-changelog
45+
uses: xile611/collect-release-changelog@main
46+
with:
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
folder: ./docs/assets/changelog
49+
langs: 'en,zh'
50+
tag_name: ${{github.event.release.tag_name}}
51+
file_name: release.md
52+
53+
- name: Push branch
54+
run: |
55+
git add .
56+
git commit -m "docs: generate changelog of release ${{ github.event.release.tag_name }}" -n
57+
git push origin docs/generate-changelog-${{ github.event.release.tag_name }}
58+
59+
- name: Create Pull Request
60+
uses: dustinirving/[email protected]
61+
with:
62+
token: ${{ secrets.GITHUB_TOKEN }}
63+
title: '[Auto changelog] changlog of ${{ github.event.release.tag_name }}'
64+
base: develop
65+
head: 'docs/generate-changelog-${{ github.event.release.tag_name }}'
66+
labels: changelog
67+
body: 'update changelog of ${{ github.event.release.tag_name }}'

0 commit comments

Comments
 (0)