1- name : release to package managers
1+ name : release
22
33concurrency : ${{ github.workflow }}-${{ github.ref }}
44
99 workflow_dispatch :
1010 inputs :
1111 force_github_package_release :
12- description : Force GPR release
12+ description : Force GPM release
1313 type : boolean
1414 required : false
1515 default : false
9797 key : ${{ runner.os }}-build-${{ hashFiles('**/bun.lockb') }}
9898
9999 - name : 🛠️ Setup Node for NPM
100- uses : actions/setup-node@v3
100+ uses : actions/setup-node@v4
101101 with :
102- node-version : latest
102+ node-version : ' 20.x '
103103 check-latest : true
104104 registry-url : ' https://registry.npmjs.org'
105105
@@ -122,14 +122,14 @@ jobs:
122122 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
123123 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
124124
125- gpr -release :
125+ gpm -release :
126126 name : 🚀 Release to GitHub Package Manager
127- if : ${{ github.event.inputs.force_github_package_release ! = 'true' || needs.release.outputs.published == 'true' }}
127+ if : ${{ github.event.inputs.force_github_package_release = = 'true' || needs.release.outputs.published == 'true' }}
128128 runs-on : ubuntu-latest
129- needs : [build, release ]
129+ needs : [build]
130130 permissions :
131- contents : read
132131 packages : write
132+ contents : read
133133 steps :
134134 - name : 🔑 Checkout Repository
135135 uses : actions/checkout@v4
@@ -145,27 +145,32 @@ jobs:
145145 path : " **/node_modules"
146146 key : ${{ runner.os }}-node-${{ hashFiles('**/bun.lockb') }}
147147
148- - name : 🛠️ Setup Node for GPR
149- uses : actions/setup-node@v3
148+ - name : ♻️ Load build files
149+ uses : actions/cache@v4
150150 with :
151- node-version : latest
151+ path : " **/dist"
152+ key : ${{ runner.os }}-build-${{ hashFiles('**/bun.lockb') }}
153+
154+ - name : 🛠️ Setup Node for GPM
155+ uses : actions/setup-node@v4
156+ with :
157+ node-version : ' 20.x'
152158 check-latest : true
153159 registry-url : ' https://npm.pkg.github.com'
154160
155- - name : 👤 Set git user
156- run : |
157- git config --global user.email "lukemorales@live.com"
158- git config --global user.name "Luke Morales"
159-
160161 - name : 📦 Install dependencies
161162 if : steps.bun-cache.outputs.cache-hit != 'true'
162163 run : bun install --frozen-lockfile
163164
164- - name : ⚒️ Build package
165- run : bun run build
165+ - name : ♼ Change package.json name
166+ uses : sergeysova/jq-action@v2
167+ with :
168+ cmd : echo "$( jq '.name="@${{ github.repository }}"' package.json )" > package.json
166169
167- - name : 🚀 Publish to GPR
168- run : npm publish
170+ - name : 🚀 Publish to GPM
171+ run : |
172+ echo "//npm.pkg.github.com/:_authToken=${{ env.NODE_AUTH_TOKEN }}" >> .npmrc
173+ echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com" >> .npmrc
174+ npm publish --registry=https://npm.pkg.github.com
169175 env :
170176 NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
171- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments