1616 - name : Use Node.js
1717 uses : actions/setup-node@v4
1818 with :
19- node-version : ' 20 '
19+ node-version : ' 24 '
2020 cache : ' npm'
2121
2222 - name : Install dependencies
@@ -84,11 +84,46 @@ jobs:
8484 draft : false
8585 prerelease : false
8686 token : ${{ secrets.GITHUB_TOKEN }}
87+
88+ npm-publish :
89+ name : Publish to NPM
90+ runs-on : ubuntu-latest
91+ needs : test
92+
93+ steps :
94+ - uses : actions/checkout@v4
95+
96+ - name : Use Node.js
97+ uses : actions/setup-node@v4
98+ with :
99+ node-version : ' 20'
100+ cache : ' npm'
101+ registry-url : ' https://registry.npmjs.org'
102+
103+ - name : Install dependencies
104+ run : npm ci
87105
88- docker :
106+ - name : Get version from tag
107+ id : get_version
108+ run : |
109+ VERSION=${GITHUB_REF#refs/tags/v}
110+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
111+
112+ - name : Update package.json version
113+ run : npm version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version
114+
115+ - name : Publish to npm
116+ run : npm publish --access public
117+ env :
118+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
119+
120+ docker :
89121 name : Build and Push Docker Image
90122 runs-on : ubuntu-latest
91123 needs : release
124+ permissions :
125+ contents : read
126+ packages : write
92127
93128 steps :
94129 - uses : actions/checkout@v4
@@ -100,6 +135,9 @@ jobs:
100135 echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
101136 echo "VERSION_NO_V=${VERSION#v}" >> $GITHUB_OUTPUT
102137
138+ - name : Set lowercase repository name
139+ run : echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
140+
103141 - name : Set up Docker Buildx
104142 uses : docker/setup-buildx-action@v3
105143
@@ -116,10 +154,11 @@ jobs:
116154 context : .
117155 push : true
118156 tags : |
119- ghcr.io/${{ github.repository }}:latest
120- ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}
121- ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION_NO_V }}
157+ ghcr.io/${{ env.REPO_LC }}:latest
158+ ghcr.io/${{ env.REPO_LC }}:${{ steps.get_version.outputs.VERSION }}
159+ ghcr.io/${{ env.REPO_LC }}:${{ steps.get_version.outputs.VERSION_NO_V }}
122160 cache-from : type=gha
123161 cache-to : type=gha,mode=max
124162 build-args : |
125163 VERSION=${{ steps.get_version.outputs.VERSION_NO_V }}
164+
0 commit comments