Skip to content

Commit

Permalink
chore: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
xile611 committed Dec 27, 2023
1 parent 5ded285 commit 69e21f7
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 33 deletions.
47 changes: 37 additions & 10 deletions .github/workflows/hotfix-release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: hotfix-release CI
name: hotfix release CI

on:
push:
branches:
- 'hotfix/[0-9]+.[0-9]+.[0-9]+\+hotfix.[0-9]+'
- 'hotfix/[0-9]+.[0-9]+.[0-9]+'

jobs:
build:
runs-on: macOS-latest

permissions:
contents: write
pull-requests: write

strategy:
matrix:
Expand All @@ -19,6 +19,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- run: |
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand All @@ -38,8 +42,14 @@ jobs:
semver_string: ${{ github.ref_name }}
semver_pattern: '^hotfix/(.*)$' # ^v?(.*)$ by default

- name: Apply prereleaseName
run: node common/scripts/apply-prerelease-version.js '' ${{ steps.semver_parser.outputs.main }} ${{ steps.semver_parser.outputs.build }}
- name: update nextBump of version policies
uses: xile611/set-next-bump-of-rush@main
with:
release_version: ${{ steps.semver_parser.outputs.full }}
write_next_bump: true

- name: Update version
run: node common/scripts/install-run-rush.js version --bump

- name: Build packages
env:
Expand Down Expand Up @@ -72,9 +82,26 @@ jobs:
path: packages/vchart

- name: Commit & Push changes
uses: actions-js/push@master
run: |
git add .
git commit -m 'build: prelease version ${{ steps.package-version.outputs.current_version }}' -n
git push origin ${{ github.ref_name }}
- name: Collect changelog of rush
uses: xile611/collect-rush-changlog@main
id: changelog
with:
version: ${{ steps.package-version.outputs.current_version }}

- name: Create Release for Tag
id: release_tag
uses: ncipollo/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: 'build: release hotfix version ${{ steps.package-version.outputs.current_version }}'
branch: ${{ github.ref_name }}
author_name: ${{ github.actor }}
tag: v${{ steps.package-version.outputs.current_version }}
commit: main
prerelease: false
body: |
${{ steps.changelog.outputs.markdown }}
draft: true #
29 changes: 29 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check of pull request

# 这里业务方根据需求设置
on:
pull_request:
branches: ['develop', 'dev/**']
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: './common/config/rush/pnpm-lock.yaml'

- uses: xile611/pr-type-check@main
with:
pull_request_body: |
${{ github.event.pull_request.body }}
pull_request_head: ${{ github.event.pull_request.head.ref }}
61 changes: 61 additions & 0 deletions .github/workflows/release-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release changelog

on:
release:
types: [published]

jobs:
update-changelog-after-publish-a-release:
name: GitHub Actions Test
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
- run: |
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: './common/config/rush/pnpm-lock.yaml'

# Install rush
- name: Install rush
run: node common/scripts/install-run-rush.js install --bypass-policy

- name: generate changelog
id: generate-changelog
uses: xile611/collect-release-changelog@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
folder: ./docs/assets/changelog
langs: 'en,zh'
tag_name: ${{github.event.release.tag_name}}
file_name: changelog.md

- name: Create branch
run: |
git checkout -b docs/generate-changelog-${{ github.event.release.tag_name }}
# Make any necessary changes
git add .
git commit -m "docs: generate changelog of release ${{ github.event.release.tag_name }}" -n
git push origin docs/generate-changelog-${{ github.event.release.tag_name }}
- name: Create Pull Request
uses: dustinirving/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: '[Auto changelog] changlog of ${{ github.event.release.tag_name }}'
base: develop
head: 'docs/generate-changelog-${{ github.event.release.tag_name }}'
labels: changelog
body: 'update changelog of ${{ github.event.release.tag_name }}'
21 changes: 10 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ jobs:
NODE_OPTIONS: '--max_old_space_size=4096'
run: node common/scripts/install-run-rush.js build --only @visactor/wx-vchart

# - name: Run Bugserver
# working-directory: ./packages/vchart
# env:
# BUG_SERVER_TOKEN: ${{ secrets.BUG_SERVER_TOKEN }}
# run: node ../../common/scripts/install-run-rushx.js ci
- name: Run Bugserver
working-directory: ./packages/vchart
env:
BUG_SERVER_TOKEN: ${{ secrets.BUG_SERVER_TOKEN }}
run: node ../../common/scripts/install-run-rushx.js ci

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: node common/scripts/install-run-rush.js publish --publish --include-all
run: node common/scripts/install-run-rush.js publish --publish --include-all --tag latest

- name: Update shrinkwrap
run: node common/scripts/install-run-rush.js update
Expand All @@ -88,11 +88,10 @@ jobs:
path: packages/vchart

- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: 'build: prelease version ${{ steps.package-version.outputs.current_version }}'
branch: ${{ github.ref_name }}
run: |
git add .
git commit -m 'build: prelease version ${{ steps.package-version.outputs.current_version }}' -n
git push origin ${{ github.ref_name }}
- name: Collect changelog of rush
uses: xile611/collect-rush-changlog@main
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/sync-main-to-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,17 @@ jobs:
with:
path: packages/vchart

- name: Checkout a new branch from main
- name: Create a new branch
run: |
git status
git fetch origin main:main
git checkout main
git checkout -b 'sync-mian-${{ steps.package-version.outputs.current_version }}-to-develop'
git push origin 'sync-main-${{ steps.package-version.outputs.current_version }}-to-develop'
git checkout -b sync/main-${{ steps.package-version.outputs.current_version }}
git push origin sync/main-${{ steps.package-version.outputs.current_version }}
- name: Create Pull Request
uses: dustinirving/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: '[Auto merge] synchronize branch main to develop after release ${{ steps.package-version.outputs.current_version }}'
title: '[Auto Sync] Sync the code from branch main to branch develop after release ${{ steps.package-version.outputs.current_version }}'
base: develop
head: 'sync-${{ steps.package-version.outputs.current_version }}-to-develop'
labels: release # default labels, the action will throw error if not specified
reviewers: kkxxkk2019 # default reviewers, the action will throw error if not specified
body: |
synchronize branch main to develop
head: sync/main-${{ steps.package-version.outputs.current_version }}
reviewers: xile611
body: 'Sync the code from branch main to branch develop after release ${{ steps.package-version.outputs.current_version }}'

0 comments on commit 69e21f7

Please sign in to comment.