Skip to content

Commit d60d7b9

Browse files
committed
build: 更新项目构建配置
- 移除 .gitlab-ci.yml 文件,停止使用 GitLab CI/CD - 删除 .gitpod.yml 文件,移除 Gitpod 配置 - 更新 package.json 版本号至 0.0.3
1 parent b73d1ff commit d60d7b9

File tree

4 files changed

+68
-37
lines changed

4 files changed

+68
-37
lines changed

.github/workflows/master.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Node.js CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
25+
- name: Install dependencies
26+
run: npm install
27+
28+
- name: Run unit tests
29+
run: npm test
30+
31+
- name: Build project
32+
run: npm run build
33+
34+
- name: docs
35+
run: npm run docs
36+
37+
- name: Deploy to GitHub Pages
38+
uses: peaceiris/actions-gh-pages@v3
39+
with:
40+
github_token: ${{ secrets.GITHUB_TOKEN }}
41+
publish_dir: ./public
42+
43+
- name: Check npm version
44+
id: check-npm-version
45+
run: |
46+
CURRENT_VERSION=$(node -p "require('./package.json').version")
47+
PUBLISHED_VERSION=$(npm view . version 2>/dev/null || echo "0.0.0")
48+
if [ "$CURRENT_VERSION" != "$PUBLISHED_VERSION" ]; then
49+
echo "::set-output name=publish::true"
50+
else
51+
echo "::set-output name=publish::false"
52+
fi
53+
54+
- name: Publish to npm
55+
if: steps.check-npm-version.outputs.publish == 'true'
56+
run: |
57+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
58+
npm run release
59+
60+
- name: Create git tag
61+
if: steps.check-npm-version.outputs.publish == 'true'
62+
run: |
63+
VERSION=$(node -p "require('./package.json').version")
64+
git config --global user.name "github-actions[bot]"
65+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
66+
git tag -a v$VERSION -m "Release v$VERSION"
67+
git push origin v$VERSION

.gitlab-ci.yml

-33
This file was deleted.

.gitpod.yml

-3
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@feng3d/render-api",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "渲染接口",
55
"author": "feng",
66
"license": "MIT",

0 commit comments

Comments
 (0)