Skip to content

Commit

Permalink
update: CI
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed May 28, 2024
1 parent dbf94bc commit e34b26c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 55 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# https://github.com/pnpm/action-setup/issues/99#issuecomment-1918361558
- run: corepack enable
- name: install node and pnpm
uses: actions/setup-node@v4
uses: pnpm/action-setup@v4
with:
node-version: 20
cache: "pnpm"
version: 8

- name: install
run: pnpm install
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- run: corepack enable
- name: install node and pnpm
uses: actions/setup-node@v4
uses: pnpm/action-setup@v4
with:
node-version: 20
cache: "pnpm"
version: 8

- name: Install dependencies
run: pnpm install
Expand Down
89 changes: 43 additions & 46 deletions .github/workflows/main-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,50 @@ jobs:
permissions:
contents: write
steps:
# environment
- name: checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# https://github.com/pnpm/action-setup/issues/99#issuecomment-1918361558
- run: corepack enable
- name: install node and pnpm
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
# environment
- name: checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: install node and pnpm
uses: pnpm/action-setup@v4
with:
version: 8

# prepare
- run: pnpm install
- run: pnpm run lint
- run: pnpm run format
# prepare
- run: pnpm install
- run: pnpm run lint
- run: pnpm run format

# build normal and minify version, save to folder
- name: build minify
run: pnpm run build:minify
- name: mkdir
run: mkdir build-release
- name: move and rename file
run: mv dist/bilibili-cleaner.user.js build-release/bilibili-cleaner.min.user.js
- name: build default
run: pnpm run build
- name: copy file
run: cp dist/bilibili-cleaner.user.js build-release/
- name: list files
run: ls -lah build-release/
# build normal and minify version, save to folder
- name: build minify
run: pnpm run build:minify
- name: mkdir
run: mkdir build-release
- name: move and rename file
run: mv dist/bilibili-cleaner.user.js build-release/bilibili-cleaner.min.user.js
- name: build default
run: pnpm run build
- name: copy file
run: cp dist/bilibili-cleaner.user.js build-release/
- name: list files
run: ls -lah build-release/

# release
- name: get version num
id: get_vernum
run: |
version=${{ github.ref_name }}
vernum=$( echo $version | sed 's/[^0-9]//g')
echo "New version: $vernum"
echo "VERSION_NUM=$vernum" >> "$GITHUB_OUTPUT"
# release
- name: get version num
id: get_vernum
run: |
version=${{ github.ref_name }}
vernum=$( echo $version | sed 's/[^0-9]//g')
echo "New version: $vernum"
echo "VERSION_NUM=$vernum" >> "$GITHUB_OUTPUT"
- name: release action
uses: ncipollo/release-action@v1
with:
artifacts: 'build-release/*.js'
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
body: '## [更新日志](https://github.com/festoney8/bilibili-cleaner/blob/main/CHANGELOG.md#${{ steps.get_vernum.outputs.VERSION_NUM }})'
token: ${{ secrets.GITHUB_TOKEN }}
- name: release action
uses: ncipollo/release-action@v1
with:
artifacts: 'build-release/*.js'
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
body: '## [更新日志](https://github.com/festoney8/bilibili-cleaner/blob/main/CHANGELOG.md#${{ steps.get_vernum.outputs.VERSION_NUM }})'
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit e34b26c

Please sign in to comment.