Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: enhance publish scripts #1182

Merged
merged 1 commit into from
Apr 6, 2025
Merged

Conversation

antongolub
Copy link
Collaborator

@antongolub antongolub commented Apr 2, 2025

  • Tests pass
  • Appropriate changes to README are included in PR

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the CI publish scripts by incorporating dynamic versioning based on commit information and updating JSON files accordingly.

  • Adds a step in jsr-publish.yml to export SHA_SHORT and ZX_VERSION from jsr.json.
  • Updates version information in jsr.json and package.json using jq in both jsr-publish.yml and dev-publish.yml.
  • Adds new environment variable exports in dev-publish.yml for ZX_DEV_VERSION and ZX_LITE_DEV_VERSION.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/publish.yml Minor cleanup without affecting the core publish functionality.
.github/workflows/jsr-publish.yml Adds version info extraction and updates jsr.json with computed version.
.github/workflows/dev-publish.yml Exports additional version variables and updates package.json and jsr.json accordingly.
Comments suppressed due to low confidence (2)

.github/workflows/dev-publish.yml:61

  • [nitpick] Consider adding a descriptive name for the new run step that exports ZX_DEV_VERSION and ZX_LITE_DEV_VERSION to improve clarity in the workflow.
-      - run: |

.github/workflows/jsr-publish.yml:57

  • [nitpick] Using shell command substitution with jq in this way can be error-prone; consider using jq's in-place update options (if available) or capturing the output in a variable before rewriting the file to ensure the JSON structure remains intact.
cat <<< $(jq '.version="${{ env.ZX_VERSION }}-dev.${{ env.SHA_SHORT }}"' jsr.json) > jsr.json

@@ -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 is powered by AI, so mistakes are possible. Review output carefully before use.

@antongolub antongolub merged commit de0b5ed into google:main Apr 6, 2025
28 checks passed
@antongolub antongolub deleted the ci-enhance-publish branch April 6, 2025 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant