-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Refactor Github Action per b/485167538 #19301
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,15 +90,19 @@ runs: | |
| id: 'release_branch' | ||
| shell: 'bash' | ||
| run: | | ||
| BRANCH_NAME="release/${{ inputs.release-tag }}" | ||
| BRANCH_NAME="release/${INPUTS_RELEASE_TAG}" | ||
| git switch -c "${BRANCH_NAME}" | ||
| echo "BRANCH_NAME=${BRANCH_NAME}" >> "${GITHUB_OUTPUT}" | ||
| env: | ||
| INPUTS_RELEASE_TAG: ${{ inputs.release-tag }} | ||
|
|
||
| - name: '⬆️ Update package versions' | ||
| working-directory: '${{ inputs.working-directory }}' | ||
| shell: 'bash' | ||
| run: | | ||
| npm run release:version "${{ inputs.release-version }}" | ||
| npm run release:version "${INPUTS_RELEASE_VERSION}" | ||
| env: | ||
| INPUTS_RELEASE_VERSION: ${{ inputs.release-version }} | ||
|
|
||
| - name: '💾 Commit and Conditionally Push package versions' | ||
| working-directory: '${{ inputs.working-directory }}' | ||
|
|
@@ -160,23 +164,30 @@ runs: | |
| working-directory: '${{ inputs.working-directory }}' | ||
| env: | ||
| NODE_AUTH_TOKEN: '${{ steps.core-token.outputs.auth-token }}' | ||
| INPUTS_DRY_RUN: ${{ inputs.dry-run }} | ||
| INPUTS_CORE_PACKAGE_NAME: ${{ inputs.core-package-name }} | ||
| shell: 'bash' | ||
| run: | | ||
| npm publish \ | ||
| --dry-run="${{ inputs.dry-run }}" \ | ||
| --workspace="${{ inputs.core-package-name }}" \ | ||
| --dry-run="${INPUTS_DRY_RUN}" \ | ||
| --workspace="${INPUTS_CORE_PACKAGE_NAME}" \ | ||
| --no-tag | ||
| npm dist-tag rm ${{ inputs.core-package-name }} false --silent | ||
| npm dist-tag rm ${INPUTS_CORE_PACKAGE_NAME} false --silent | ||
|
|
||
| - name: '🔗 Install latest core package' | ||
| working-directory: '${{ inputs.working-directory }}' | ||
| if: "${{ inputs.dry-run != 'true' }}" | ||
| shell: 'bash' | ||
| run: | | ||
| npm install "${{ inputs.core-package-name }}@${{ inputs.release-version }}" \ | ||
| --workspace="${{ inputs.cli-package-name }}" \ | ||
| --workspace="${{ inputs.a2a-package-name }}" \ | ||
| npm install "${INPUTS_CORE_PACKAGE_NAME}@${INPUTS_RELEASE_VERSION}" \ | ||
| --workspace="${INPUTS_CLI_PACKAGE_NAME}" \ | ||
| --workspace="${INPUTS_A2A_PACKAGE_NAME}" \ | ||
| --save-exact | ||
| env: | ||
| INPUTS_CORE_PACKAGE_NAME: ${{ inputs.core-package-name }} | ||
| INPUTS_RELEASE_VERSION: ${{ inputs.release-version }} | ||
| INPUTS_CLI_PACKAGE_NAME: ${{ inputs.cli-package-name }} | ||
| INPUTS_A2A_PACKAGE_NAME: ${{ inputs.a2a-package-name }} | ||
|
|
||
| - name: 'Get CLI Token' | ||
| uses: './.github/actions/npm-auth-token' | ||
|
|
@@ -192,13 +203,15 @@ runs: | |
| working-directory: '${{ inputs.working-directory }}' | ||
| env: | ||
| NODE_AUTH_TOKEN: '${{ steps.cli-token.outputs.auth-token }}' | ||
| INPUTS_DRY_RUN: ${{ inputs.dry-run }} | ||
| INPUTS_CLI_PACKAGE_NAME: ${{ inputs.cli-package-name }} | ||
| shell: 'bash' | ||
| run: | | ||
| npm publish \ | ||
| --dry-run="${{ inputs.dry-run }}" \ | ||
| --workspace="${{ inputs.cli-package-name }}" \ | ||
| --dry-run="${INPUTS_DRY_RUN}" \ | ||
| --workspace="${INPUTS_CLI_PACKAGE_NAME}" \ | ||
| --no-tag | ||
| npm dist-tag rm ${{ inputs.cli-package-name }} false --silent | ||
| npm dist-tag rm ${INPUTS_CLI_PACKAGE_NAME} false --silent | ||
|
Comment on lines
209
to
+214
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The npm publish \
--dry-run="${INPUTS_DRY_RUN}" \
--workspace="${INPUTS_CLI_PACKAGE_NAME}" \
--no-tag
npm dist-tag rm "${INPUTS_CLI_PACKAGE_NAME}" false --silent |
||
|
|
||
| - name: 'Get a2a-server Token' | ||
| uses: './.github/actions/npm-auth-token' | ||
|
|
@@ -214,14 +227,16 @@ runs: | |
| working-directory: '${{ inputs.working-directory }}' | ||
| env: | ||
| NODE_AUTH_TOKEN: '${{ steps.a2a-token.outputs.auth-token }}' | ||
| INPUTS_DRY_RUN: ${{ inputs.dry-run }} | ||
| INPUTS_A2A_PACKAGE_NAME: ${{ inputs.a2a-package-name }} | ||
| shell: 'bash' | ||
| # Tag staging for initial release | ||
| run: | | ||
| npm publish \ | ||
| --dry-run="${{ inputs.dry-run }}" \ | ||
| --workspace="${{ inputs.a2a-package-name }}" \ | ||
| --dry-run="${INPUTS_DRY_RUN}" \ | ||
| --workspace="${INPUTS_A2A_PACKAGE_NAME}" \ | ||
| --no-tag | ||
| npm dist-tag rm ${{ inputs.a2a-package-name }} false --silent | ||
| npm dist-tag rm ${INPUTS_A2A_PACKAGE_NAME} false --silent | ||
|
Comment on lines
234
to
+239
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and security, the npm publish \
--dry-run="${INPUTS_DRY_RUN}" \
--workspace="${INPUTS_A2A_PACKAGE_NAME}" \
--no-tag
npm dist-tag rm "${INPUTS_A2A_PACKAGE_NAME}" false --silent |
||
|
|
||
| - name: '🔬 Verify NPM release by version' | ||
| uses: './.github/actions/verify-release' | ||
|
|
@@ -255,13 +270,16 @@ runs: | |
| if: "${{ inputs.dry-run != 'true' && inputs.skip-github-release != 'true' && inputs.npm-tag != 'dev' && inputs.npm-registry-url != 'https://npm.pkg.github.com/' }}" | ||
| env: | ||
| GITHUB_TOKEN: '${{ inputs.github-token }}' | ||
| INPUTS_RELEASE_TAG: ${{ inputs.release-tag }} | ||
| STEPS_RELEASE_BRANCH_OUTPUTS_BRANCH_NAME: ${{ steps.release_branch.outputs.BRANCH_NAME }} | ||
| INPUTS_PREVIOUS_TAG: ${{ inputs.previous-tag }} | ||
| shell: 'bash' | ||
| run: | | ||
| gh release create "${{ inputs.release-tag }}" \ | ||
| gh release create "${INPUTS_RELEASE_TAG}" \ | ||
| bundle/gemini.js \ | ||
| --target "${{ steps.release_branch.outputs.BRANCH_NAME }}" \ | ||
| --title "Release ${{ inputs.release-tag }}" \ | ||
| --notes-start-tag "${{ inputs.previous-tag }}" \ | ||
| --target "${STEPS_RELEASE_BRANCH_OUTPUTS_BRANCH_NAME}" \ | ||
| --title "Release ${INPUTS_RELEASE_TAG}" \ | ||
| --notes-start-tag "${INPUTS_PREVIOUS_TAG}" \ | ||
| --generate-notes | ||
|
|
||
| - name: '🧹 Clean up release branch' | ||
|
|
@@ -270,5 +288,8 @@ runs: | |
| continue-on-error: true | ||
| shell: 'bash' | ||
| run: | | ||
| echo "Cleaning up release branch ${{ steps.release_branch.outputs.BRANCH_NAME }}..." | ||
| git push origin --delete "${{ steps.release_branch.outputs.BRANCH_NAME }}" | ||
| echo "Cleaning up release branch ${STEPS_RELEASE_BRANCH_OUTPUTS_BRANCH_NAME}..." | ||
| git push origin --delete "${STEPS_RELEASE_BRANCH_OUTPUTS_BRANCH_NAME}" | ||
|
|
||
| env: | ||
| STEPS_RELEASE_BRANCH_OUTPUTS_BRANCH_NAME: ${{ steps.release_branch.outputs.BRANCH_NAME }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,10 +71,13 @@ runs: | |
| ${{ inputs.dry-run != 'true' }} | ||
| env: | ||
| NODE_AUTH_TOKEN: '${{ steps.core-token.outputs.auth-token }}' | ||
| INPUTS_CORE_PACKAGE_NAME: ${{ inputs.core-package-name }} | ||
| INPUTS_VERSION: ${{ inputs.version }} | ||
| INPUTS_CHANNEL: ${{ inputs.channel }} | ||
| shell: 'bash' | ||
| working-directory: '${{ inputs.working-directory }}' | ||
| run: | | ||
| npm dist-tag add ${{ inputs.core-package-name }}@${{ inputs.version }} ${{ inputs.channel }} | ||
| npm dist-tag add ${INPUTS_CORE_PACKAGE_NAME}@${INPUTS_VERSION} ${INPUTS_CHANNEL} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| - name: 'Get cli Token' | ||
| uses: './.github/actions/npm-auth-token' | ||
|
|
@@ -91,10 +94,13 @@ runs: | |
| ${{ inputs.dry-run != 'true' }} | ||
| env: | ||
| NODE_AUTH_TOKEN: '${{ steps.cli-token.outputs.auth-token }}' | ||
| INPUTS_CLI_PACKAGE_NAME: ${{ inputs.cli-package-name }} | ||
| INPUTS_VERSION: ${{ inputs.version }} | ||
| INPUTS_CHANNEL: ${{ inputs.channel }} | ||
| shell: 'bash' | ||
| working-directory: '${{ inputs.working-directory }}' | ||
| run: | | ||
| npm dist-tag add ${{ inputs.cli-package-name }}@${{ inputs.version }} ${{ inputs.channel }} | ||
| npm dist-tag add ${INPUTS_CLI_PACKAGE_NAME}@${INPUTS_VERSION} ${INPUTS_CHANNEL} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| - name: 'Get a2a Token' | ||
| uses: './.github/actions/npm-auth-token' | ||
|
|
@@ -111,15 +117,29 @@ runs: | |
| ${{ inputs.dry-run == 'false' }} | ||
| env: | ||
| NODE_AUTH_TOKEN: '${{ steps.a2a-token.outputs.auth-token }}' | ||
| INPUTS_A2A_PACKAGE_NAME: ${{ inputs.a2a-package-name }} | ||
| INPUTS_VERSION: ${{ inputs.version }} | ||
| INPUTS_CHANNEL: ${{ inputs.channel }} | ||
| shell: 'bash' | ||
| working-directory: '${{ inputs.working-directory }}' | ||
| run: | | ||
| npm dist-tag add ${{ inputs.a2a-package-name }}@${{ inputs.version }} ${{ inputs.channel }} | ||
| npm dist-tag add ${INPUTS_A2A_PACKAGE_NAME}@${INPUTS_VERSION} ${INPUTS_CHANNEL} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| - name: 'Log dry run' | ||
| if: |- | ||
| ${{ inputs.dry-run == 'true' }} | ||
| shell: 'bash' | ||
| working-directory: '${{ inputs.working-directory }}' | ||
| run: | | ||
| echo "Dry run: Would have added tag '${{ inputs.channel }}' to version '${{ inputs.version }}' for ${{ inputs.cli-package-name }}, ${{ inputs.core-package-name }}, and ${{ inputs.a2a-package-name }}." | ||
| echo "Dry run: Would have added tag '${INPUTS_CHANNEL}' to version '${INPUTS_VERSION}' for ${INPUTS_CLI_PACKAGE_NAME}, ${INPUTS_CORE_PACKAGE_NAME}, and ${INPUTS_A2A_PACKAGE_NAME}." | ||
|
|
||
| env: | ||
| INPUTS_CHANNEL: ${{ inputs.channel }} | ||
|
|
||
| INPUTS_VERSION: ${{ inputs.version }} | ||
|
|
||
| INPUTS_CLI_PACKAGE_NAME: ${{ inputs.cli-package-name }} | ||
|
|
||
| INPUTS_CORE_PACKAGE_NAME: ${{ inputs.core-package-name }} | ||
|
|
||
| INPUTS_A2A_PACKAGE_NAME: ${{ inputs.a2a-package-name }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
${INPUTS_CORE_PACKAGE_NAME}variable should be double-quoted in thenpm dist-tag rmcommand. This prevents potential issues like word splitting or globbing if the package name contains spaces or other shell metacharacters. While npm package names have restrictions, quoting variables in shell scripts is a crucial best practice for robustness and security.