@@ -103,7 +103,8 @@ jobs:
103103 steps :
104104 - name : Checkout repository
105105 uses : actions/checkout@v4
106-
106+ with :
107+ fetch-depth : 0
107108 - name : Set up Docker Buildx
108109 uses : docker/setup-buildx-action@v3
109110
@@ -121,4 +122,39 @@ jobs:
121122 file : Dockerfile
122123 push : true
123124 tags : " ${{ secrets.DOCKER_USER }}/huly-coder:${{ env.VERSION }},${{ secrets.DOCKER_USER }}/huly-coder:latest"
124- platforms : linux/amd64,linux/arm64
125+ platforms : linux/amd64,linux/arm64
126+
127+ publish-npm :
128+ name : Publish the base package to NPM
129+ needs : upload-assets
130+ runs-on : ubuntu-22.04
131+ steps :
132+ - name : Checkout
133+ uses : actions/checkout@v4
134+ with :
135+ fetch-depth : 0
136+ - name : Set the release version
137+ shell : bash
138+ # Extract the version number from the "refs/tags/huly-coder-vx.x.x"
139+ run : echo "RELEASE_VERSION=${GITHUB_REF:22}" >> $GITHUB_ENV
140+ - name : Install node
141+ uses : actions/setup-node@v4
142+ with :
143+ node-version : 18
144+ registry-url : " https://registry.npmjs.org"
145+ - name : Publish the package
146+ shell : bash
147+ working-directory : npm/huly-coder
148+ run : |
149+ export version="${{ env.RELEASE_VERSION }}"
150+ envsubst < ../main-package.json.tmpl > "package.json"
151+ yarn config set npmAuthToken ${NODE_AUTH_TOKEN}
152+ yarn config set npmPublishRegistry "https://registry.npmjs.org"
153+ yarn install
154+ yarn build
155+ cp ../../README.md .
156+ cp ../../CHANGELOG.md .
157+ yarn npm publish
158+ env :
159+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
160+ YARN_ENABLE_IMMUTABLE_INSTALLS : false
0 commit comments