Skip to content

Commit

Permalink
chore: update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Aug 6, 2024
1 parent e38c740 commit 1b81918
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 92 deletions.
40 changes: 40 additions & 0 deletions .github/action/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 6 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
post-update:
# if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
Expand All @@ -35,17 +36,8 @@ jobs:
run: |
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
run: |
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/changeset-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,14 @@ jobs:
timeout-minutes: 15
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20]

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
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
uses: changesets/action@v1
Expand Down
52 changes: 6 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [20]
os:
- ubuntu-latest
- macos-latest
Expand All @@ -38,27 +37,8 @@ jobs:
with:
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
# run: git --version
Expand All @@ -80,7 +60,6 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [20]
os:
- ubuntu-latest
- macos-latest
Expand All @@ -92,17 +71,8 @@ jobs:
with:
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
run: pnpm run lint
Expand All @@ -113,7 +83,6 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
node-version: [20]
os:
- ubuntu-latest
- macos-latest
Expand All @@ -124,17 +93,8 @@ jobs:
with:
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
run: pnpm check:type
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ jobs:
name: Deploy Push Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -33,17 +29,8 @@ jobs:
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./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
run: pnpm run build
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/issue-close-require.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
schedule:
- cron: "0 0 * * *"

permissions:
pull-requests: write
contents: write

jobs:
close-issues:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/issue-labeled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
# pull_request:
# types: [labeled]

permissions:
issues: write
pull-requests: write
contents: write

jobs:
reply-labeled:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
env:
HUSKY: "0"

permissions:
pull-requests: write
contents: write

jobs:
build:
name: Create Release
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,19 @@ jobs:
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
requireScope: false
types: |
fix
feat
docs
style
refactor
perf
test
build
ci
chore
revert
types
release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
20.14.0
1 change: 0 additions & 1 deletion internal/lint-configs/commitlint-config/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ const userConfig = {
'revert',
'types',
'release',
'improvement',
],
],
},
Expand Down

0 comments on commit 1b81918

Please sign in to comment.