Skip to content

Commit

Permalink
chore: github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
hubert committed Jul 25, 2024
1 parent b04b412 commit d28f6af
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check PR title
on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize


permissions:
statuses: write

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: aslafy-z/conventional-pr-title-action@v3
with:
preset: "@commitlint/config-conventional@^12.1.4"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check Commit spec

on:
push:
branches: [master]
pull_request:
branches: [master]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:


permissions:
contents: read
pull-requests: read

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0=
- uses: wagoid/commitlint-github-action@v3
env:
NODE_PATH: ${{ github.workspace }}/node_modules
60 changes: 60 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy

on:
# release:
# types: [published]
push: # push 到主分支自动 发布
branches: ['master']
paths-ignore: # 忽略一些不必要的文件
- '.gitignore'
- 'README.md'
- '.vscode/**'
- '.devcontainer/**'

permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest
environment:
name: 'production'
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '16.14'
- name: Cache Dependencies
uses: actions/cache@v3
id: cache
with:
path: |
node_modules
.yarn/cache
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --mode=skip-build
- name: Configure Git User
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{github.actor}}"
git config --list
- name: Authenticate with Registry
run: |
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish
run: |
npx lerna publish --yes
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit d28f6af

Please sign in to comment.