-
Notifications
You must be signed in to change notification settings - Fork 429
chore: add license headers and CI #2929
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
Draft
cabljac
wants to merge
17
commits into
master
Choose a base branch
from
next
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
072d3ea
chore(deps): bump the version-minor-and-patch group across 1 director…
dependabot[bot] cd84656
Merge pull request #2914 from firebase/dependabot/npm_and_yarn/versio…
inlined 7b624a6
chore: enforce Apache license headers with google/addlicense (#2928)
cabljac 71a28ea
Add release workflow
inlined cd30b83
Fix zizmore findings in new file only (existing errors still present)
inlined 0384dc3
Another attempt to fix zizmor
inlined b2e181c
More zizmor fixes. Trusted publishing seems incompatible with Google
inlined 95834dc
Apparently I have to fix ALL zizmore issues if I touch any action
inlined fdab1cf
Merge origin/next into inlined.kit-release-pipeline and resolve confl…
inlined 8a6bb32
Fix credential persistence finding in validate.yml license job
inlined 69233e0
Fix incorrect actions/cache commit hash in readmes-updated.yml
inlined 8fc5d09
Merge pull request #2940 from firebase/inlined.kit-release-pipeline
inlined f97c164
fix(ci): remove workspace flags and support target_branch parameter
inlined b1c5c19
fix(ci): use public registry for npm ci during build step
inlined 6fcc767
fix(ci): pass target_branch via env to resolve zizmor template-injection
inlined 587c3a0
chore(ci): remove target_branch parameter in favor of github.ref_name
inlined cc4c613
Merge pull request #2944 from firebase/inlined.kit-release-pipeline
inlined File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,265 @@ | ||
| name: Release Kit | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| target_kit: | ||
| description: "Kit / Package to publish" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - "kits/bigquery-firestore-export" | ||
| - "kits/delete-user-data" | ||
| - "kits/firestore-bigquery-export" | ||
| - "kits/firestore-bundle-builder" | ||
| - "kits/firestore-counter" | ||
| - "kits/firestore-genai-chatbot" | ||
| - "kits/firestore-incremental-capture" | ||
| - "kits/firestore-send-email" | ||
| - "kits/firestore-translate-text" | ||
| - "kits/firestore-vector-search" | ||
| - "kits/rtdb-limit-child-nodes" | ||
| - "kits/speech-to-text" | ||
| - "kits/storage-resize-images" | ||
| bump_level: | ||
| description: "Version Bump Level" | ||
| required: true | ||
| default: "patch" | ||
| type: choice | ||
| options: | ||
| - "patch" | ||
| - "minor" | ||
| - "major" | ||
| is_prerelease: | ||
| description: "Publish as Release Candidate (RC)" | ||
| required: true | ||
| default: true | ||
| type: boolean | ||
| dry_run: | ||
| description: "Dry run (validate without pushing/publishing)" | ||
| required: true | ||
| default: true | ||
| type: boolean | ||
|
|
||
| jobs: | ||
| # ========================================================= | ||
| # 1. TEST JOB (Low Permissions: Read-Only) | ||
| # ========================================================= | ||
| test: | ||
| name: Run Tests | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # zizmor: ignore[artipacked] | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| with: | ||
| node-version: "24" | ||
|
|
||
| - name: Install Dependencies & Run Tests | ||
| working-directory: ${{ inputs.target_kit }} | ||
| run: | | ||
|
|
||
| npm ci | ||
| npm test | ||
|
|
||
| # ========================================================= | ||
| # 2. RELEASE JOB (Elevated Permissions: Write) | ||
| # ========================================================= | ||
| release: | ||
| name: Version, Publish & Tag Release | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # Needed to push version commit, git tag & create GitHub Release | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # zizmor: ignore[artipacked] | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| with: | ||
| node-version: "24" | ||
| registry-url: "https://wombat-dressing-room.appspot.com" | ||
| always-auth: false | ||
|
|
||
| - name: Configure Git User | ||
| if: ${{ !inputs.dry_run }} | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Read & Validate CHANGELOG.md | ||
| id: changelog | ||
| working-directory: ${{ inputs.target_kit }} | ||
| run: | | ||
| CHANGELOG_FILE="CHANGELOG.md" | ||
|
|
||
| if [ ! -f "$CHANGELOG_FILE" ]; then | ||
| echo "::error file=${{ inputs.target_kit }}/CHANGELOG.md::CHANGELOG.md is missing! Releasing requires a CHANGELOG.md file." | ||
| exit 1 | ||
| fi | ||
|
|
||
| NOTES=$(cat "$CHANGELOG_FILE") | ||
|
|
||
| if [ -z "$(echo "$NOTES" | tr -d '[:space:]')" ]; then | ||
| echo "::error file=${{ inputs.target_kit }}/CHANGELOG.md::CHANGELOG.md is empty! Please populate it with release notes before publishing." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Output notes via multiline heredoc | ||
| EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | ||
| echo "notes<<$EOF" >> $GITHUB_OUTPUT | ||
| echo "$NOTES" >> $GITHUB_OUTPUT | ||
| echo "$EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Determine Version Bump Type | ||
| id: config | ||
| working-directory: ${{ inputs.target_kit }} | ||
| env: | ||
| BUMP_LEVEL: ${{ inputs.bump_level }} | ||
| IS_PRERELEASE: ${{ inputs.is_prerelease }} | ||
| run: | | ||
| CURRENT_VER=$(node -p "require('./package.json').version") | ||
| BUMP="$BUMP_LEVEL" | ||
|
|
||
| if [ "$IS_PRERELEASE" = "true" ]; then | ||
| if [[ "$CURRENT_VER" =~ -rc\.[0-9]+$ ]]; then | ||
| BUMP_TYPE="prerelease" | ||
| else | ||
| BUMP_TYPE="pre${BUMP}" | ||
| fi | ||
| TARGET_TAG="next" | ||
| else | ||
| BUMP_TYPE="$BUMP" | ||
| TARGET_TAG="latest (and next)" | ||
| fi | ||
|
|
||
| echo "current_ver=$CURRENT_VER" >> $GITHUB_OUTPUT | ||
| echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT | ||
| echo "target_tag=$TARGET_TAG" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Install Dependencies & Build | ||
| working-directory: ${{ inputs.target_kit }} | ||
| run: | | ||
| npm ci --registry=https://registry.npmjs.org | ||
| npm run build | ||
|
|
||
| - name: Bump Version (Clear CHANGELOG on Stable Release Only) | ||
| id: versioning | ||
| working-directory: ${{ inputs.target_kit }} | ||
| env: | ||
| BUMP_TYPE: ${{ steps.config.outputs.bump_type }} | ||
| IS_PRERELEASE: ${{ inputs.is_prerelease }} | ||
| DRY_RUN: ${{ inputs.dry_run }} | ||
| run: | | ||
| if [ "$DRY_RUN" = "true" ]; then | ||
| npm version $BUMP_TYPE --preid=rc --no-git-tag-version | ||
| else | ||
| # Only truncate CHANGELOG.md if this is a STABLE release (not a prerelease) | ||
| if [ "$IS_PRERELEASE" != "true" ]; then | ||
| echo "Stable release detected: clearing CHANGELOG.md..." | ||
| > CHANGELOG.md | ||
| git add CHANGELOG.md | ||
| else | ||
| echo "Prerelease detected: preserving CHANGELOG.md content." | ||
| fi | ||
|
|
||
| # Create version bump commit and git tag | ||
| if [[ "$BUMP_TYPE" == pre* ]] || [[ "$BUMP_TYPE" == "prerelease" ]]; then | ||
| npm version $BUMP_TYPE --preid=rc -m "chore(release): %s [skip ci]" | ||
| else | ||
| npm version $BUMP_TYPE -m "chore(release): %s [skip ci]" | ||
| fi | ||
| fi | ||
|
|
||
| NEW_VER=$(node -p "require('./package.json').version") | ||
| PKG_NAME=$(node -p "require('./package.json').name") | ||
|
|
||
| echo "version=$NEW_VER" >> $GITHUB_OUTPUT | ||
| echo "pkg_name=$PKG_NAME" >> $GITHUB_OUTPUT | ||
| echo "tag_name=${PKG_NAME}@${NEW_VER}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Dry Run Summary | ||
| if: ${{ inputs.dry_run }} | ||
| env: | ||
| PKG_NAME: ${{ steps.versioning.outputs.pkg_name }} | ||
| TARGET_KIT: ${{ inputs.target_kit }} | ||
| CURRENT_VER: ${{ steps.config.outputs.current_ver }} | ||
| VERSION: ${{ steps.versioning.outputs.version }} | ||
| BUMP_TYPE: ${{ steps.config.outputs.bump_type }} | ||
| TARGET_TAG: ${{ steps.config.outputs.target_tag }} | ||
| IS_PRERELEASE: ${{ inputs.is_prerelease }} | ||
| TAG_NAME: ${{ steps.versioning.outputs.tag_name }} | ||
| NOTES: ${{ steps.changelog.outputs.notes }} | ||
| run: | | ||
| echo "==========================================================" | ||
| echo " DRY RUN SUMMARY " | ||
| echo "==========================================================" | ||
| echo " Package Name: $PKG_NAME" | ||
| echo " Target Directory: $TARGET_KIT" | ||
| echo " Current Version: $CURRENT_VER" | ||
| echo " Target Version: $VERSION" | ||
| echo " Version Bump: $BUMP_TYPE" | ||
| echo " NPM Dist-Tag: $TARGET_TAG" | ||
| echo " Release Type: $( [ "$IS_PRERELEASE" = "true" ] && echo "Release Candidate (RC)" || echo "Stable Release" )" | ||
| echo " Git Tag Name: $TAG_NAME" | ||
| echo " CHANGELOG State: $( [ "$IS_PRERELEASE" = "true" ] && echo "Preserved" || echo "Will be cleared on publish" )" | ||
| echo "----------------------------------------------------------" | ||
| echo " Release Notes from CHANGELOG.md:" | ||
| echo "$NOTES" | ||
| echo "==========================================================" | ||
|
|
||
| - name: Push Version Commit & Tags to Branch | ||
| if: ${{ !inputs.dry_run }} | ||
| env: | ||
| REF_NAME: ${{ github.ref_name }} | ||
| run: git push origin "$REF_NAME" --follow-tags | ||
|
|
||
| - name: Publish to NPM | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| # zizmor: ignore[use-trusted-publishing] | ||
| working-directory: ${{ inputs.target_kit }} | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| IS_PRERELEASE: ${{ inputs.is_prerelease }} | ||
| DRY_RUN: ${{ inputs.dry_run }} | ||
| PKG_NAME: ${{ steps.versioning.outputs.pkg_name }} | ||
| VERSION: ${{ steps.versioning.outputs.version }} | ||
| run: | | ||
| DRY_RUN_FLAG="" | ||
| if [ "$DRY_RUN" = "true" ]; then | ||
| DRY_RUN_FLAG="--dry-run" | ||
| echo "Executing npm publish with --dry-run..." | ||
| fi | ||
|
|
||
| if [ "$IS_PRERELEASE" = "true" ]; then | ||
| npm publish --tag next --access public $DRY_RUN_FLAG | ||
| else | ||
| npm publish --tag latest --access public $DRY_RUN_FLAG | ||
| if [ "$DRY_RUN" != "true" ]; then | ||
| npm dist-tag add ${PKG_NAME}@${VERSION} next | ||
| fi | ||
| fi | ||
|
|
||
| - name: Create GitHub Release via GitHub CLI | ||
| if: ${{ !inputs.dry_run }} | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| TAG_NAME: ${{ steps.versioning.outputs.tag_name }} | ||
| PKG_NAME: ${{ steps.versioning.outputs.pkg_name }} | ||
| VERSION: ${{ steps.versioning.outputs.version }} | ||
| IS_PRERELEASE: ${{ inputs.is_prerelease }} | ||
| NOTES: ${{ steps.changelog.outputs.notes }} | ||
| REF_NAME: ${{ github.ref_name }} | ||
| run: | | ||
| PRERELEASE_FLAG="" | ||
| if [ "$IS_PRERELEASE" = "true" ]; then | ||
| PRERELEASE_FLAG="--prerelease" | ||
| fi | ||
|
|
||
| gh release create "$TAG_NAME" \ | ||
| --title "$PKG_NAME v$VERSION" \ | ||
| --notes "$NOTES" \ | ||
| --target "$REF_NAME" \ | ||
| $PRERELEASE_FLAG | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.