Browse Source

ci: update action (#4046)

* ci: update action
pull/4059/head
Vben 1 month ago
committed by GitHub
parent
commit
4bd4f7490b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 40
      .github/actions/setup-node/action.yml
  2. 25
      .github/workflows/build.yml
  3. 19
      .github/workflows/changeset-version.yml
  4. 52
      .github/workflows/ci.yml
  5. 17
      .github/workflows/deploy.yml
  6. 2
      .github/workflows/draft.yml
  7. 6
      .github/workflows/issue-close-require.yml
  8. 11
      .github/workflows/issue-labeled.yml
  9. 2
      .github/workflows/lock.yml
  10. 8
      .github/workflows/release-tag.yml
  11. 16
      .github/workflows/semantic-pull-request.yml
  12. 2
      .github/workflows/stale.yml
  13. 2
      .node-version
  14. 1
      internal/lint-configs/commitlint-config/index.mjs

40
.github/actions/setup-node/action.yml

@ -0,0 +1,40 @@
name: "Setup Node"
description: "Setup node and pnpm"
runs:
using: "composite"
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: "pnpm"
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
if: ${{ github.ref_name == 'main' }}
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- uses: actions/cache/restore@v4
if: ${{ github.ref_name != 'main' }}
with:
path: ${{ env.STORE_PATH }}
key: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile

25
.github/workflows/build.yml

@ -13,13 +13,17 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs: jobs:
post-update: post-update:
# if: ${{ github.actor == 'dependabot[bot]' }} # if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -28,21 +32,12 @@ jobs:
- name: Checkout out pull request - name: Checkout out pull request
env: env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
gh pr checkout ${{ github.event.pull_request.number }} gh pr checkout ${{ github.event.pull_request.number }}
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build - name: Build
run: | run: |

19
.github/workflows/changeset-version.yml

@ -23,27 +23,14 @@ jobs:
timeout-minutes: 15 timeout-minutes: 15
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Create Release Pull Request - name: Create Release Pull Request
uses: changesets/action@v1 uses: changesets/action@v1
@ -52,4 +39,4 @@ jobs:
commit: "chore: bump versions" commit: "chore: bump versions"
title: "chore: bump versions" title: "chore: bump versions"
env: env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

52
.github/workflows/ci.yml

@ -21,7 +21,6 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
node-version: [20]
os: os:
- ubuntu-latest - ubuntu-latest
- macos-latest - macos-latest
@ -38,27 +37,8 @@ jobs:
with: with:
run_install: false run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Find pnpm store path
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup Node
uses: ./.github/actions/setup-node
# - name: Check Git version # - name: Check Git version
# run: git --version # run: git --version
@ -80,7 +60,6 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
node-version: [20]
os: os:
- ubuntu-latest - ubuntu-latest
- macos-latest - macos-latest
@ -92,17 +71,8 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Lint - name: Lint
run: pnpm run lint run: pnpm run lint
@ -113,7 +83,6 @@ jobs:
timeout-minutes: 20 timeout-minutes: 20
strategy: strategy:
matrix: matrix:
node-version: [20]
os: os:
- ubuntu-latest - ubuntu-latest
- macos-latest - macos-latest
@ -124,17 +93,8 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Typecheck - name: Typecheck
run: pnpm check:type run: pnpm check:type

17
.github/workflows/deploy.yml

@ -10,10 +10,6 @@ jobs:
name: Deploy Push Ftp name: Deploy Push Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]') if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -33,17 +29,8 @@ jobs:
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-naive/.env.production sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-naive/.env.production
cat ./apps/web-naive/.env.production cat ./apps/web-naive/.env.production
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build - name: Build
run: pnpm run build run: pnpm run build

2
.github/workflows/draft.yml

@ -14,4 +14,4 @@ jobs:
steps: steps:
- uses: release-drafter/release-drafter@v6 - uses: release-drafter/release-drafter@v6
env: env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

6
.github/workflows/issue-close-require.yml

@ -6,6 +6,10 @@ on:
schedule: schedule:
- cron: "0 0 * * *" - cron: "0 0 * * *"
permissions:
pull-requests: write
contents: write
jobs: jobs:
close-issues: close-issues:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -16,6 +20,6 @@ jobs:
uses: actions-cool/issues-helper@v3 uses: actions-cool/issues-helper@v3
with: with:
actions: "close-issues" # 执行动作:关闭 Issues actions: "close-issues" # 执行动作:关闭 Issues
token: ${{ secrets.ACCESS_TOKEN }} # GitHub Token,用于认证
token: ${{ secrets.GITHUB_TOKEN }} # GitHub Token,用于认证
labels: "need reproduction" # 目标标签 labels: "need reproduction" # 目标标签
inactive-day: 3 # 未活动天数阈值 inactive-day: 3 # 未活动天数阈值

11
.github/workflows/issue-labeled.yml

@ -6,6 +6,11 @@ on:
# pull_request: # pull_request:
# types: [labeled] # types: [labeled]
permissions:
issues: write
pull-requests: write
contents: write
jobs: jobs:
reply-labeled: reply-labeled:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -15,7 +20,7 @@ jobs:
uses: actions-cool/issues-helper@v3 uses: actions-cool/issues-helper@v3
with: with:
actions: "remove-labels" actions: "remove-labels"
token: ${{ secrets.ACCESS_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }} issue-number: ${{ github.event.issue.number }}
labels: "enhancement: pending triage" labels: "enhancement: pending triage"
@ -24,7 +29,7 @@ jobs:
uses: actions-cool/issues-helper@v3 uses: actions-cool/issues-helper@v3
with: with:
actions: "remove-labels" actions: "remove-labels"
token: ${{ secrets.ACCESS_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }} issue-number: ${{ github.event.issue.number }}
labels: "bug: pending triage" labels: "bug: pending triage"
@ -33,7 +38,7 @@ jobs:
uses: actions-cool/issues-helper@v3 uses: actions-cool/issues-helper@v3
with: with:
actions: "create-comment, remove-labels" actions: "create-comment, remove-labels"
token: ${{ secrets.ACCESS_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }} issue-number: ${{ github.event.issue.number }}
body: | body: |
Hello @${{ github.event.issue.user.login }}. Please provide the complete reproduction steps and code. Issues labeled by `needs reproduction` will be closed if no activities in 3 days. Hello @${{ github.event.issue.user.login }}. Please provide the complete reproduction steps and code. Issues labeled by `needs reproduction` will be closed if no activities in 3 days.

2
.github/workflows/lock.yml

@ -15,7 +15,7 @@ jobs:
steps: steps:
- uses: dessant/lock-threads@v5 - uses: dessant/lock-threads@v5
with: with:
github-token: ${{ secrets.ACCESS_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-inactive-days: "30" issue-inactive-days: "30"
issue-lock-reason: "" issue-lock-reason: ""
pr-inactive-days: "30" pr-inactive-days: "30"

8
.github/workflows/release-tag.yml

@ -8,6 +8,10 @@ on:
env: env:
HUSKY: "0" HUSKY: "0"
permissions:
pull-requests: write
contents: write
jobs: jobs:
build: build:
name: Create Release name: Create Release
@ -58,7 +62,7 @@ jobs:
version: ${{ steps.version.outputs.version }} version: ${{ steps.version.outputs.version }}
publish: true publish: true
env: env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: force update major tag # - name: force update major tag
# run: | # run: |
@ -69,7 +73,7 @@ jobs:
# id: release_tag # id: release_tag
# uses: ncipollo/release-action@v1 # uses: ncipollo/release-action@v1
# with: # with:
# token: ${{ secrets.ACCESS_TOKEN }}
# token: ${{ secrets.GITHUB_TOKEN }}
# generateReleaseNotes: "true" # generateReleaseNotes: "true"
# body: | # body: |
# > Please refer to [CHANGELOG.md](https://github.com/vbenjs/vue-vben-admin/blob/main/CHANGELOG.md) for details. # > Please refer to [CHANGELOG.md](https://github.com/vbenjs/vue-vben-admin/blob/main/CHANGELOG.md) for details.

16
.github/workflows/semantic-pull-request.yml

@ -22,5 +22,19 @@ jobs:
didn't match the configured pattern. Please ensure that the subject didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character. doesn't start with an uppercase character.
requireScope: false requireScope: false
types: |
fix
feat
docs
style
refactor
perf
test
build
ci
chore
revert
types
release
env: env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2
.github/workflows/stale.yml

@ -10,7 +10,7 @@ jobs:
steps: steps:
- uses: actions/stale@v9 - uses: actions/stale@v9
with: with:
repo-token: ${{ secrets.ACCESS_TOKEN }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days" stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days"
stale-pr-message: "This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days" stale-pr-message: "This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days"
exempt-issue-labels: "bug,enhancement" exempt-issue-labels: "bug,enhancement"

2
.node-version

@ -1 +1 @@
20
20.14.0

1
internal/lint-configs/commitlint-config/index.mjs

@ -145,7 +145,6 @@ const userConfig = {
'revert', 'revert',
'types', 'types',
'release', 'release',
'improvement',
], ],
], ],
}, },

Loading…
Cancel
Save