Skip to content

Commit d28f6af

Browse files
author
hubert
committed
chore: github actions
1 parent b04b412 commit d28f6af

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Check PR title
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
- reopened
7+
- edited
8+
- synchronize
9+
10+
11+
permissions:
12+
statuses: write
13+
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: aslafy-z/conventional-pr-title-action@v3
19+
with:
20+
preset: "@commitlint/config-conventional@^12.1.4"
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/commitlint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Check Commit spec
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
13+
permissions:
14+
contents: read
15+
pull-requests: read
16+
17+
jobs:
18+
commitlint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0=
24+
- uses: wagoid/commitlint-github-action@v3
25+
env:
26+
NODE_PATH: ${{ github.workspace }}/node_modules

.github/workflows/deploy.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy
2+
3+
on:
4+
# release:
5+
# types: [published]
6+
push: # push 到主分支自动 发布
7+
branches: ['master']
8+
paths-ignore: # 忽略一些不必要的文件
9+
- '.gitignore'
10+
- 'README.md'
11+
- '.vscode/**'
12+
- '.devcontainer/**'
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
publish:
19+
runs-on: ubuntu-latest
20+
environment:
21+
name: 'production'
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 0
27+
- name: Set up Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '16.14'
31+
- name: Cache Dependencies
32+
uses: actions/cache@v3
33+
id: cache
34+
with:
35+
path: |
36+
node_modules
37+
.yarn/cache
38+
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-node-
41+
- name: Install Dependencies
42+
if: steps.cache.outputs.cache-hit != 'true'
43+
run: yarn install --mode=skip-build
44+
- name: Configure Git User
45+
run: |
46+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
47+
git config --global user.name "${{github.actor}}"
48+
git config --list
49+
- name: Authenticate with Registry
50+
run: |
51+
echo "registry=https://registry.npmjs.org/" >> .npmrc
52+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
53+
npm whoami
54+
env:
55+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
- name: Publish
57+
run: |
58+
npx lerna publish --yes
59+
env:
60+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)