1111 GIT_USER: 'GitHub Actions'
1212 GIT_EMAIL: 'github-actions[bot]@users.noreply.github.com'
1313 CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
14+ DEFAULT_OS: ubuntu-latest
15+ DEFAULT_NODE_VERSION: 22
1416
1517jobs:
1618 build:
2325 node-version: [18, 20, 22]
2426 steps:
2527 - uses: actions/checkout@v4
26- - uses: actions/setup-node@v1
28+ - uses: actions/setup-node@v4
2729 with:
2830 node-version: ${{ matrix.node-version }}
2931 - name: Install Python setup tools
@@ -42,28 +44,31 @@ jobs:
4244 run: yarn test
4345 - name: Report coverage
4446 run: yarn codecov
45- - name: Upload js bundle
46- uses: actions/upload-artifact@v4
47- with:
48- name: js-bundle
49- path: dist
5047 - name: Upload binary artifact
5148 uses: actions/upload-artifact@v4
5249 with:
53- name: "${{ matrix.os }}.${{ matrix.node-version }}.zip "
50+ name: "${{ matrix.os }}.${{ matrix.node-version }}"
5451 path: build/stage
5552
5653 deploy:
5754 needs: build
5855 runs-on: ubuntu-latest
5956 steps:
6057 - uses: actions/checkout@v4
58+ - uses: actions/setup-node@v4
6159 with:
62- persist-credentials: false
63- - name: Pull latest
64- run: git pull origin main
65- - name: Install Vuepress
66- run: yarn add vuepress@next -D
60+ node-version: ${{ env.DEFAULT_NODE_VERSION }}
61+ - name: Install Python setup tools
62+ run: pip install setuptools
63+ - name: Install dependencies
64+ run: yarn
65+ - name: Build project
66+ run: yarn build
67+ - name: Upload js bundle
68+ uses: actions/upload-artifact@v4
69+ with:
70+ name: js-bundle
71+ path: dist
6772 - name: Build documentation
6873 run: yarn docs:build
6974 - name: Create CNAME Record
@@ -79,18 +84,16 @@ jobs:
7984 CLEAN: true
8085
8186 release:
82- needs: build
87+ needs: deploy
8388 runs-on: ubuntu-latest
8489 steps:
8590 - uses: actions/checkout@v4
86- - uses: TriPSs/conventional-changelog-action@v3
87- with:
88- github-token: ${{ secrets.GITHUB_TOKEN }}
89- git-user-name: ${{ env.GIT_USER }}
90- git-user-email: ${{ env.GIT_EMAIL }}
91- tag-prefix: 'v'
92- release-count: '0'
93- skip-on-empty: false
91+ - name: Configure committer
92+ run: |
93+ git config user.name "${{ env.GIT_USER }}"
94+ git config user.email "${{ env.GIT_EMAIL }}"
95+ - name: Bump version
96+ uses: qzb/standard-version-action@v1.0.5
9497
9598 upload-binaries:
9699 needs: release
@@ -100,18 +103,18 @@ jobs:
100103 - name: Download binary artifacts
101104 uses: actions/download-artifact@v4
102105 with:
103- name: "${{ matrix.os }}.${{ matrix.node-version }}.zip"
104106 path: build/stage
105107 - name: Upload binary artifacts to release
106108 # only one folder will be present in build/stage, which is named the new version number
107109 # extract this name and set it as the release name, then upload artifact binaries to it
108110 run: |
111+ rm -rf ./build/stage/js-bundle
109112 set -x
110113 assets=()
111- for asset in ./build/stage/**/*; do
114+ for asset in ./build/stage/**/**/* ; do
112115 assets+=("$asset")
113116 done
114- RELEASE_VERSION=$(echo $(ls build/stage| head -1))
117+ RELEASE_VERSION=$(echo $(ls build/stage/${{ env.DEFAULT_OS }}.${{ env.DEFAULT_NODE_VERSION }} | head -1))
115118 gh release create -t "v$RELEASE_VERSION" "$RELEASE_VERSION" "${assets[@]}"
116119 env:
117120 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -128,10 +131,18 @@ jobs:
128131 with:
129132 name: js-bundle
130133 path: dist
131- - uses: actions/setup-node@v1
134+ - uses: actions/setup-node@v4
132135 with:
133- node-version: 22
136+ node-version: ${{ env.DEFAULT_NODE_VERSION }}
134137 registry-url: https://registry.npmjs.org/
138+ - name: Set git credentials
139+ run: |
140+ git config --global user.email ${{ env.GIT_USER }}
141+ git config --global user.name ${{ env.GIT_EMAIL }}
142+ - name: Install dependencies
143+ run: yarn
144+ - name: Create initial release
145+ run: yarn release
135146 - run: npm publish
136147 env:
137148 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
0 commit comments