@@ -19,15 +19,16 @@ jobs:
1919 node-version : ' 18.x'
2020 registry-url : ' https://registry.npmjs.org'
2121 # Extract the dynamic value from the canary label if present
22- - name : Extract dynamic value from canary label
22+ - name : Extract CANARY_TAG
2323 id : extract-canary
2424 run : |
25- if [[ "${GITHUB_EVENT_LABEL_NAME}" == canary:* ]]; then
26- CANARY_TAG="${GITHUB_EVENT_LABEL_NAME#canary:}"
27- echo "CANARY_TAG=${CANARY_TAG}" >> $GITHUB_ENV
28- fi
29- env :
30- GITHUB_EVENT_LABEL_NAME : ${{ github.event.label.name }}
25+ export LABELS_JSON='${{ toJson(github.event.pull_request.labels) }}'
26+ CANARY_TAG=$(node -e "
27+ const labels = JSON.parse(process.env.LABELS_JSON || '[]');
28+ const canaryLabel = labels.find(label => label.name.startsWith('canary:'));
29+ if (canaryLabel) console.log(canaryLabel.name.split(':')[1]);
30+ ")
31+ echo "CANARY_TAG=$CANARY_TAG" >> $GITHUB_ENV
3132 # Ensure that the README is published with the package
3233 - run : rm -f packages/cli/README.md && cp README.md packages/cli
3334 - run : echo "PR_VERSION=0.0.0-pr.${{github.event.pull_request.number}}.$(git rev-parse --short HEAD)" >> $GITHUB_ENV
@@ -36,10 +37,13 @@ jobs:
3637 # Publish to npm with the additional tag if CANARY_TAG is set
3738 - run : |
3839 npm publish --workspace packages/cli --tag experimental
39- if [[ -n "${{ env.CANARY_TAG }}" ]]; then
40- npm dist-tag add checkly@${{ env.PR_VERSION }} ${{ env.CANARY_TAG }}
41- fi
40+ if [[ -n "$CANARY_TAG" ]]; then
41+ echo "Publishing with additional tag: $CANARY_TAG"
42+ npm dist-tag add checkly@$PR_VERSION $CANARY_TAG
43+ fi
4244 env:
45+ CANARY_TAG: ${{ env.CANARY_TAG }}
46+ PR_VERSION: ${{ env.PR_VERSION }}
4347 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4448 - uses : marocchino/sticky-pull-request-comment@v2
4549 with :
0 commit comments