Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/dev-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
run: |
echo SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_ENV
echo ZX_VERSION=$(jq -r '.version' package.json) >> $GITHUB_ENV
- run: |
echo ZX_DEV_VERSION="${{ env.ZX_VERSION }}-dev.${{ env.SHA_SHORT }}" >> $GITHUB_ENV
echo ZX_LITE_DEV_VERSION="${{ env.ZX_VERSION }}-lite-dev.${{ env.SHA_SHORT }}" >> $GITHUB_ENV
- name: Configure npmrc
run: |
echo "//${{ env.GOOGLE_NPM_REGISTRY }}/:_authToken=$GOOGLE_NPM_TOKEN" >> .npmrc
Expand All @@ -69,7 +72,7 @@ jobs:

- name: pushing to ${{ env.GOOGLE_NPM_REGISTRY }}
run: |
npm version ${{ env.ZX_VERSION }}-dev.${{ env.SHA_SHORT }} --no-git-tag-version
cat <<< $(jq '.version="${{ env.ZX_DEV_VERSION }}"' package.json) > package.json
Copy link
Preview

Copilot AI Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using 'cat' with a here-string and jq inline can lead to potential overwrites; using jq with an in-place update flag might improve robustness and clarity.

Suggested change
cat <<< $(jq '.version="${{ env.ZX_DEV_VERSION }}"' package.json) > package.json
jq --arg version "${{ env.ZX_DEV_VERSION }}" '.version=$version' package.json > tmp.$$.json && mv tmp.$$.json package.json

Copilot uses AI. Check for mistakes.

npm publish --provenance --access=public --no-git-tag-version --tag dev --registry https://${{ env.GOOGLE_NPM_REGISTRY }}

- name: pushing to ${{ env.GH_NPM_REGISTRY }}
Expand All @@ -80,13 +83,13 @@ jobs:
- name: pushing lite snapshot to ${{ env.GOOGLE_NPM_REGISTRY }}
run: |
cat <<< $(jq '.name="zx"' package.json) > package.json
cat <<< $(jq '.version="${{ env.ZX_LITE_DEV_VERSION }}"' package.json) > package.json
node scripts/prepublish-lite.mjs
npm version ${{ env.ZX_VERSION }}-lite-dev.${{ env.SHA_SHORT }} --no-git-tag-version
npm publish --provenance --access=public --no-git-tag-version --tag dev --registry https://${{ env.GOOGLE_NPM_REGISTRY }}

- name: pushing to jsr.io
run: |
cat <<< $(jq '.version="${{ env.ZX_VERSION }}-dev.${{ env.SHA_SHORT }}"' jsr.json) > jsr.json
cat <<< $(jq '.version="${{ env.ZX_DEV_VERSION }}"' jsr.json) > jsr.json
npx jsr publish --allow-dirty

# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/jsr-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,12 @@ jobs:
with:
name: build-${{ github.run_id }}

- name: Get zx version info
run: |
echo SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_ENV
echo ZX_VERSION=$(jq -r '.version' jsr.json) >> $GITHUB_ENV

- name: pushing to jsr.io
run: npx jsr publish --allow-dirty
run: |
cat <<< $(jq '.version="${{ env.ZX_VERSION }}-dev.${{ env.SHA_SHORT }}"' jsr.json) > jsr.json
npx jsr publish --allow-dirty
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ jobs:
- name: pushing to jsr.io
run: npx jsr publish --allow-dirty

# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
docker-publish:
needs: build
runs-on: ubuntu-latest
Expand All @@ -92,7 +91,6 @@ jobs:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
Expand Down