Repository navigation
67 lines (65 loc) · 1.91 KB
/
Copy pathdefault.yml
File metadata and controls
67 lines (65 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: CI
on:
push:
branches:
- master
- alpha
permissions:
id-token: write
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: init
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@gmail.com"
- name: pull-code
uses: actions/checkout@v7
- name: install-node
uses: actions/setup-node@v7
with:
node-version: 24.x
cache: 'npm'
- name: install-dependencies
run: |
npm ci --legacy-peer-deps
- name: lint
run: |
npm run lint
- name: check builder schema
run: |
npm run check:schema
- name: hook-code
run: |
npm run sync
- name: test
run: |
npm run test:ci
- name: build
run: |
npm run build
- name: dist-tag
id: dist-tag
run: |
# master -> latest,其它分支(alpha 等)-> 分支同名 tag
if [ "${GITHUB_REF_NAME}" = "master" ]; then
echo "tag=latest" >> "$GITHUB_OUTPUT"
else
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi
- id: publish
name: publish
uses: JS-DevTools/npm-publish@v4
if: ${{ github.repository_owner == 'wszgrcy' }}
with:
package: ./dist/package.json
tag: ${{ steps.dist-tag.outputs.tag }}
provenance: true
access: public
- if: ${{ github.repository_owner == 'wszgrcy' && steps.publish.outputs.type }}
run: |
echo "[${{ steps.publish.outputs.type }}]Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }} (dist-tag: ${{ steps.dist-tag.outputs.tag }})"
git tag v${{steps.publish.outputs.version}}
git push origin v${{steps.publish.outputs.version}}