@@ -152,90 +152,90 @@ jobs:
152152 - test
153153 - attw
154154 strategy :
155- runs-on : ubuntu-22.04
156- permissions :
157- contents : read
158- id-token : write
159- steps :
160- - uses : actions/checkout@v4
161-
162- - uses : actions/setup-node@v4
163- with :
164- node-version : ' 22'
165- registry-url : ' https://registry.npmjs.org'
166-
167- - uses : pnpm/action-setup@v3
168- name : Install pnpm
169- id : pnpm-install
170- with :
171- version : latest
172- run_install : false
173-
174- - name : Get pnpm store directory
175- id : pnpm-cache
176- shell : bash
177- run : |
178- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
179-
180- - uses : actions/cache@v4
181- name : Setup pnpm cache
182- with :
183- path : ${{ steps.pnpm-cache.outputs.STORE_PATH }}
184- key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
185- restore-keys : |
186- ${{ runner.os }}-pnpm-store-
187-
188- - name : Install dependencies
189- run : pnpm install
190-
191- - name : Check preconditions
192- id : checks
193- shell : bash
194- working-directory : waddler
195- run : |
196- old_version="$(jq -r .version package.json)"
197- version="$old_version-$(git rev-parse --short HEAD)"
198- npm version $version
199- tag="${{ github.ref_name }}"
200- is_version_published="$(npm view waddler versions --json | jq -r '.[] | select(. == "'$version'") | . == "'$version'"')"
201-
202- if [[ "$is_version_published" == "true" ]]; then
203- echo "\`waddler$version\` already published, adding tag \`$tag\`" >> $GITHUB_STEP_SUMMARY
204- npm dist-tag add waddler@$version $tag
205- else
206- {
207- echo "version=$version"
208- echo "tag=$tag"
209- echo "has_new_release=true"
210- } >> $GITHUB_OUTPUT
211- fi
212-
213- - name : Build
214- if : steps.checks.outputs.has_new_release == 'true'
215- run : pnpm build
216-
217- - name : Pack
218- if : steps.checks.outputs.has_new_release == 'true'
219- working-directory : waddler
220- shell : bash
221- env :
222- NODE_AUTH_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
223- run : npm run pack
224-
225- - name : Publish
226- if : github.event_name == 'push' && steps.checks.outputs.has_new_release == 'true'
227- run : |
228- tag="${{ steps.checks.outputs.tag }}"
229- version="${{ steps.checks.outputs.version }}"
230-
231- echo "Publishing waddler@$tag using version $version"
232- npm run publish -- --tag $tag
233-
234- echo "npm: \`waddler@$tag | waddler@$version\`" >> $GITHUB_STEP_SUMMARY
235-
236- # Post release message to Discord
237- # curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`waddler\` release! 🎉\", \"url\": \"https://www.npmjs.com/package/waddler/v/$version\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Version\", \"value\": \"\`$version\`\"}, {\"name\": \"Tag\", \"value\": \"\`$tag\`\"}]}]}" ${{ secrets.DISCORD_DEV_RELEASE_WEBHOOK_URL }}
238- working-directory : waddler
239- shell : bash
240- env :
241- NODE_AUTH_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
155+ runs-on : ubuntu-22.04
156+ permissions :
157+ contents : read
158+ id-token : write
159+ steps :
160+ - uses : actions/checkout@v4
161+
162+ - uses : actions/setup-node@v4
163+ with :
164+ node-version : ' 22'
165+ registry-url : ' https://registry.npmjs.org'
166+
167+ - uses : pnpm/action-setup@v3
168+ name : Install pnpm
169+ id : pnpm-install
170+ with :
171+ version : latest
172+ run_install : false
173+
174+ - name : Get pnpm store directory
175+ id : pnpm-cache
176+ shell : bash
177+ run : |
178+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
179+
180+ - uses : actions/cache@v4
181+ name : Setup pnpm cache
182+ with :
183+ path : ${{ steps.pnpm-cache.outputs.STORE_PATH }}
184+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
185+ restore-keys : |
186+ ${{ runner.os }}-pnpm-store-
187+
188+ - name : Install dependencies
189+ run : pnpm install
190+
191+ - name : Check preconditions
192+ id : checks
193+ shell : bash
194+ working-directory : waddler
195+ run : |
196+ old_version="$(jq -r .version package.json)"
197+ version="$old_version-$(git rev-parse --short HEAD)"
198+ npm version $version
199+ tag="${{ github.ref_name }}"
200+ is_version_published="$(npm view waddler versions --json | jq -r '.[] | select(. == "'$version'") | . == "'$version'"')"
201+
202+ if [[ "$is_version_published" == "true" ]]; then
203+ echo "\`waddler$version\` already published, adding tag \`$tag\`" >> $GITHUB_STEP_SUMMARY
204+ npm dist-tag add waddler@$version $tag
205+ else
206+ {
207+ echo "version=$version"
208+ echo "tag=$tag"
209+ echo "has_new_release=true"
210+ } >> $GITHUB_OUTPUT
211+ fi
212+
213+ - name : Build
214+ if : steps.checks.outputs.has_new_release == 'true'
215+ run : pnpm build
216+
217+ - name : Pack
218+ if : steps.checks.outputs.has_new_release == 'true'
219+ working-directory : waddler
220+ shell : bash
221+ env :
222+ NODE_AUTH_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
223+ run : npm run pack
224+
225+ - name : Publish
226+ if : github.event_name == 'push' && steps.checks.outputs.has_new_release == 'true'
227+ run : |
228+ tag="${{ steps.checks.outputs.tag }}"
229+ version="${{ steps.checks.outputs.version }}"
230+
231+ echo "Publishing waddler@$tag using version $version"
232+ npm run publish -- --tag $tag
233+
234+ echo "npm : \`waddler@$tag | waddler@$version\`" >> $GITHUB_STEP_SUMMARY
235+
236+ # Post release message to Discord
237+ # curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`waddler\` release! 🎉\", \"url\": \"https://www.npmjs.com/package/waddler/v/$version\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Version\", \"value\": \"\`$version\`\"}, {\"name\": \"Tag\", \"value\": \"\`$tag\`\"}]}]}" ${{ secrets.DISCORD_DEV_RELEASE_WEBHOOK_URL }}
238+ working-directory : waddler
239+ shell : bash
240+ env :
241+ NODE_AUTH_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
0 commit comments