diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 87c5bdec6..bf11b19d8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -28,3 +28,26 @@ before sending PRs. We cannot accept code without this. ### Code sample + +### Release notes + + + +relnote: none + + diff --git a/.github/workflows/lint-relnotes.yaml b/.github/workflows/lint-relnotes.yaml new file mode 100644 index 000000000..124643237 --- /dev/null +++ b/.github/workflows/lint-relnotes.yaml @@ -0,0 +1,37 @@ +name: Lint Release Notes + +on: + pull_request: + types: [opened, edited, synchronized, reopened] + +permissions: + contents: read + +jobs: + lint-pr-body: + runs-on: ubuntu-latest + steps: + - name: Validate PR Release Notes + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: | + echo "Analyzing PR description for release notes..." + + # 1. Check if the body contains a 'relnote:' or 'relnotes:' line (case-insensitive) + if ! echo "$PR_BODY" | grep -qiE '^[Rr]elnotes?:'; then + echo "❌ Error: Could not find a 'relnote:' or 'relnotes:' line in the PR description." + echo "Please ensure your PR description includes a line matching: 'relnote: ' or 'relnote: none'" + exit 1 + fi + + # 2. Extract the actual note content to ensure it isn't blank + # This grabs the line, strips the prefix, and trims trailing/leading spaces + NOTE_CONTENT=$(echo "$PR_BODY" | grep -iE '^[Rr]elnotes?:' | head -n 1 | sed -E 's/^[Rr]elnotes?:[[:space:]]*//g' | xargs) + + if [ -z "$NOTE_CONTENT" ]; then + echo "❌ Error: The 'relnote:' field is empty." + echo "Please provide a brief release note or write 'relnote: none' if this change doesn't require one." + exit 1 + fi + + echo "✅ Success! Found valid release note: '$NOTE_CONTENT'" diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index f36e5bd10..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -- fix: Remove false warning when using Expression in cors option #1802 -- feat: Add requiresRole developer API for declarative security support and automatic Manifest extraction (#1908) -- Validate literal `timeoutSeconds` values per v2 trigger type (0-540s for events, 0-3600s for HTTPS/callable, 0-1800s for task queues, 0-7s for identity functions) so misconfigured values fail at function-definition or manifest-extraction time instead of at deploy time. (#1877) -- feat: Add requiresAPI function to allow declaring Google Cloud API dependencies in code. -- fix(v1): Call onInit for schedule.onRun functions (#1801) -- feat: Add support to declare lifecycle hooks in functions. (#1915) -- fix(cors): Fix issue using Params to set CORS allowed hosts (#1903) diff --git a/package.json b/package.json index a47f12546..5ab274bf9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "firebase-functions", - "version": "7.2.6-rc.0", + "version": "0.0.0-development", "description": "Firebase SDK for Cloud Functions", "keywords": [ "firebase", diff --git a/scripts/changelog.sh b/scripts/changelog.sh new file mode 100755 index 000000000..0fe190bd5 --- /dev/null +++ b/scripts/changelog.sh @@ -0,0 +1,91 @@ +#!/bin/bash +set -e + +# Ensure we run from the repository root +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$DIR/.." + +PREVIOUS_TAG="" +for tag in $(git log --tags --simplify-by-decoration --pretty="format:%d" | grep -o 'tag: [^,)]*' | sed 's/tag: //'); do + if echo "$tag" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then + PREVIOUS_TAG="$tag" + break + fi +done + +if [ -z "$PREVIOUS_TAG" ]; then + echo "Initial release." + exit 0 +fi + +# First pass: Identify all reverted PRs and SHAs in the interval +REVERTED_PRS=" " +REVERTED_SHAS=" " +while read -r sha; do + COMMIT_SUBJECT=$(git log -1 --format="%s" "$sha") + if [[ "$COMMIT_SUBJECT" =~ ^Revert[[:space:]]\" ]]; then + # Extract PR number from revert subject: e.g. Revert "feat: foo (#123)" -> 123 + REVERTED_PR=$(echo "$COMMIT_SUBJECT" | grep -oE '\(#[0-9]+\)' | tr -d '(#)' || true) + if [ -n "$REVERTED_PR" ]; then + REVERTED_PRS+="$REVERTED_PR " + fi + + # Extract reverted commit SHA from the body: e.g. "This reverts commit 8ec5..." + REVERTED_SHA=$(git log -1 --format="%b" "$sha" | grep -iE 'this reverts commit' | sed -E 's/.*[Tt]his reverts commit[[:space:]]+([0-9a-fA-F]+).*/\1/' || true) + if [ -n "$REVERTED_SHA" ]; then + RESOLVED_SHA=$(git rev-parse "$REVERTED_SHA" 2>/dev/null || echo "$REVERTED_SHA") + REVERTED_SHAS+="$RESOLVED_SHA " + + # Also try to get the PR number associated with the reverted commit + REVERTED_SHA_SUBJECT=$(git log -1 --format="%s" "$RESOLVED_SHA" 2>/dev/null || true) + if [ -n "$REVERTED_SHA_SUBJECT" ]; then + REVERTED_SHA_PR=$(echo "$REVERTED_SHA_SUBJECT" | grep -oE '\(#[0-9]+\)' | tr -d '(#)' || true) + if [ -n "$REVERTED_SHA_PR" ]; then + REVERTED_PRS+="$REVERTED_SHA_PR " + fi + fi + fi + fi +done < <(git rev-list "${PREVIOUS_TAG}..HEAD") + +CHANGELOG_NOTES="" +while read -r sha; do + # Check if this SHA was reverted + FULL_SHA=$(git rev-parse "$sha") + if [[ "$REVERTED_SHAS" =~ " $FULL_SHA " ]]; then + continue + fi + + COMMIT_SUBJECT=$(git log -1 --format="%s" "$sha") + + # Skip revert commits themselves + if [[ "$COMMIT_SUBJECT" =~ ^Revert[[:space:]]\" ]]; then + continue + fi + + PR_SUFFIX=$(echo "$COMMIT_SUBJECT" | grep -oE '\(#[0-9]+\)$' || true) + if [ -n "$PR_SUFFIX" ]; then + PR_NUM=$(echo "$PR_SUFFIX" | tr -d '(#)') + if [[ "$REVERTED_PRS" =~ " $PR_NUM " ]]; then + continue + fi + fi + + while read -r line; do + if [ -n "$line" ]; then + if echo "$line" | grep -qE '\(#[0-9]+\)$'; then + CHANGELOG_NOTES+="- $line"$'\n' + elif [ -n "$PR_SUFFIX" ]; then + CHANGELOG_NOTES+="- $line $PR_SUFFIX"$'\n' + else + CHANGELOG_NOTES+="- $line"$'\n' + fi + fi + done < <(git log -1 --format="%b" "$sha" | \ + grep -iE '^relnotes?:' | \ + grep -vi 'relnotes?:[[:space:]]*none' | \ + sed -E 's/^[Rr]elnotes?:[[:space:]]*//g' | \ + sed -E 's/[[:space:]]*$//') +done < <(git rev-list "${PREVIOUS_TAG}..HEAD") + +echo -e "$CHANGELOG_NOTES" diff --git a/scripts/publish.sh b/scripts/publish.sh index 4840d15d1..fe2658cf0 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,162 +1,260 @@ #!/bin/bash set -e -printusage() { - echo "publish.sh " - echo "REPOSITORY_ORG and REPOSITORY_NAME should be set in the environment." - echo "e.g. REPOSITORY_ORG=user, REPOSITORY_NAME=repo" +# Ensure we run from the repository root +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$DIR/.." + +show_usage() { + echo "Firebase Functions Release Manager (Polymorphic)" + echo "Usage: ./scripts/publish.sh [options]" + echo "" + echo "Required Positional Argument:" + echo " The type of SemVer version bump" echo "" - echo "Arguments:" - echo " version: 'patch', 'minor', or 'major'." + echo "Options:" + echo " --prerelease Flag the build as a release candidate" + echo " --no-dry-run Perform real write actions (npm publish, git tag, github release)" + echo " --force Force a release even if there are no new commits since last release" + echo " --branch The Git branch to check out (defaults to cloned HEAD)" + echo " --org GitHub Organization override (defaults to 'firebase')" + echo " --repository GitHub Repository override (defaults to 'firebase-functions')" + echo " --dist-tag The npm distribution tag (defaults to 'latest')" + echo " --project The GCP project used to run the deploy pipeline" + exit 1 } -VERSION=$1 -if [[ $VERSION == "" ]]; then - printusage - exit 1 -elif [[ ! ($VERSION == "patch" || $VERSION == "minor" || $VERSION == "major" || $VERSION == "prerelease") ]]; then - printusage - exit 1 +if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + show_usage fi -if [[ $REPOSITORY_ORG == "" ]]; then - printusage - exit 1 -fi -if [[ $REPOSITORY_NAME == "" ]]; then - printusage +BUMP_TYPE=$1 +shift + +# Validate positional argument +if [[ ! "$BUMP_TYPE" =~ ^(major|minor|patch)$ ]]; then + echo "❌ Error: Invalid bump type '$BUMP_TYPE'. Must be 'major', 'minor', or 'patch'." exit 1 fi -WDIR=$(pwd) - -echo "Checking for commands..." -trap "echo 'Missing hub.'; exit 1" ERR -which hub &> /dev/null -trap - ERR - -trap "echo 'Missing node.'; exit 1" ERR -which node &> /dev/null -trap - ERR - -trap "echo 'Missing jq.'; exit 1" ERR -which jq &> /dev/null -trap - ERR -echo "Checked for commands." - -echo "Checking for Twitter credentials..." -trap "echo 'Missing Twitter credentials.'; exit 1" ERR -test -f "${WDIR}/scripts/twitter.json" -trap - ERR -echo "Checked for Twitter credentials..." - -echo "Checking for logged-in npm user..." -trap "echo 'Please login to npm using \`npm login --registry https://wombat-dressing-room.appspot.com\`'; exit 1" ERR -npm whoami --registry https://wombat-dressing-room.appspot.com -trap - ERR -echo "Checked for logged-in npm user." - -echo "Moving to temporary directory.." -TEMPDIR=$(mktemp -d) -echo "[DEBUG] ${TEMPDIR}" -cd "${TEMPDIR}" -echo "Moved to temporary directory." - -echo "Cloning repository..." -git clone "git@github.com:${REPOSITORY_ORG}/${REPOSITORY_NAME}.git" -cd "${REPOSITORY_NAME}" -echo "Cloned repository." - -if [[ $PRE_RELEASE == "" ]]; then - echo "Making sure there is a changelog..." - if [[ ! -s CHANGELOG.md ]]; then - echo "CHANGELOG.md is empty. aborting." +# Set default values +IS_PRERELEASE=false +DRY_RUN=true +FORCE_RELEASE=false +TARGET_BRANCH="" +ORG="firebase" +REPO="firebase-functions" +DIST_TAG="latest" +TARGET_PROJECT="firebase-functions-publishing" + +# Parse optional arguments +while [ "$#" -gt 0 ]; do + case "$1" in + --prerelease) + IS_PRERELEASE=true + shift + ;; + --no-dry-run) + DRY_RUN=false + shift + ;; + --force) + FORCE_RELEASE=true + shift + ;; + --branch) + TARGET_BRANCH="$2" + shift 2 + ;; + --org) + ORG="$2" + shift 2 + ;; + --repository) + REPO="$2" + shift 2 + ;; + --dist-tag) + DIST_TAG="$2" + shift 2 + ;; + --project) + TARGET_PROJECT="$2" + shift 2 + ;; + *) + # Legacy positional fallback for tags (e.g. "latest" passed at the end) + if [[ ! "$1" =~ ^- ]]; then + DIST_TAG="$1" + fi + shift + ;; + esac +done + +# ============================================================================== +# MODE A: LOCAL ORCHESTRATOR MODE (Runs on your machine) +# ============================================================================== +if [ -z "$BUILD_ID" ]; then + echo "🖥️ [Orchestrator Mode] Local terminal execution detected." + + # 1. Pre-flight CLI checks + if ! command -v gcloud &> /dev/null; then + echo "❌ Error: 'gcloud' CLI tool is not installed." exit 1 fi - echo "Made sure there is a changelog." + if [ -z "$(gcloud config get-value account 2>/dev/null)" ]; then + echo "❌ Error: No active Google Cloud account detected. Run 'gcloud auth login'." + exit 1 + fi + + # 2. Build parameter mapping + SUBSTITUTIONS="_BUMP_TYPE=$BUMP_TYPE" + [ "$IS_PRERELEASE" = true ] && SUBSTITUTIONS+=",_PRERELEASE=true" + SUBSTITUTIONS+=",_DRY_RUN=$DRY_RUN" + [ "$FORCE_RELEASE" = true ] && SUBSTITUTIONS+=",_FORCE=true" + [ -n "$TARGET_BRANCH" ] && SUBSTITUTIONS+=",_BRANCH=$TARGET_BRANCH" + SUBSTITUTIONS+=",_REPOSITORY_ORG=$ORG" + SUBSTITUTIONS+=",_REPOSITORY_NAME=$REPO" + SUBSTITUTIONS+=",_DIST_TAG=$DIST_TAG" + + echo "--------------------------------------------------------" + echo "Dispatched Release Parameters:" + echo " Bump Type: $BUMP_TYPE" + echo " Is Prerelease: $IS_PRERELEASE" + echo " Is Dry Run: $DRY_RUN" + echo " Force Release: $FORCE_RELEASE" + echo " Target Branch: ${TARGET_BRANCH:-[default]}" + echo " GitHub Host: $ORG/$REPO" + echo " NPM Tag: $DIST_TAG" + echo "--------------------------------------------------------" + + echo "Dispatched to Cloud Build..." + gcloud builds submit \ + --project="$TARGET_PROJECT" \ + --config="scripts/publish/cloudbuild.yaml" \ + --substitutions="$SUBSTITUTIONS" + exit 0 +fi + +# ============================================================================== +# MODE B: CLOUD WORKER MODE (Runs inside the Cloud Build Docker container) +# ============================================================================== +echo "☁️ [Worker Mode] Cloud Build environment detected (Build ID: $BUILD_ID)." + +# 1. Optional Branch Checkout +if [ -n "$TARGET_BRANCH" ]; then + echo "Checking out target branch: $TARGET_BRANCH..." + git checkout "$TARGET_BRANCH" fi -echo "Running npm ci..." +# 2. Clean compilation & test cycle +echo "Running clean installation..." npm ci -echo "Ran npm ci." -echo "Running tests..." +echo "Compiling workspace..." +npm run build + +echo "Executing test suite..." npm test -npm run test:bin -echo "Ran tests." -echo "Running publish build..." -npm run build -echo "Ran publish build." +# 3. Stateless Version Discovery +PACKAGE_NAME=$(node -p "require('./package.json').name") +STABLE_VERSION=$(npm view "$PACKAGE_NAME" version) -echo "Making a $VERSION version..." -if [[ $PRE_RELEASE != "" ]]; then - if [[ $VERSION == "prerelease" ]]; then - npm version prerelease --preid=rc - else - npm version pre$VERSION --preid=rc - fi +echo "--------------------------------------------------------" +echo "Package Name: $PACKAGE_NAME" +echo "Current stable version on npm: $STABLE_VERSION" +echo "Target distribution tag: $DIST_TAG" +echo "Is Prerelease: $IS_PRERELEASE" +echo "Dry Run Mode: $DRY_RUN" +echo "Force Release: $FORCE_RELEASE" +echo "GitHub Repo Target: $ORG/$REPO" +echo "--------------------------------------------------------" + +# Update package.json version dynamically in runner memory +if [ "$IS_PRERELEASE" = true ]; then + PRE_BUMP_TYPE="pre${BUMP_TYPE}" + echo "Preparing prerelease version change using '$PRE_BUMP_TYPE' (preid: rc)..." + npm version "$STABLE_VERSION" --no-git-tag-version + npm version "$PRE_BUMP_TYPE" --preid="rc" --no-git-tag-version else - npm version $VERSION -fi -NEW_VERSION=$(jq -r ".version" package.json) -echo "Made a $NEW_VERSION version." - -echo "Making the release notes..." -RELEASE_NOTES_FILE=$(mktemp) -echo "[DEBUG] ${RELEASE_NOTES_FILE}" -echo "v${NEW_VERSION}" >> "${RELEASE_NOTES_FILE}" -echo "" >> "${RELEASE_NOTES_FILE}" -cat CHANGELOG.md >> "${RELEASE_NOTES_FILE}" -echo "Made the release notes." - -echo "Publishing to npm..." -PUBLISH_ARGS=() -if [[ -n "$DRY_RUN" ]]; then - echo "DRY RUN: running publish with --dry-run" - PUBLISH_ARGS+=(--dry-run) + echo "Preparing stable version change using '$BUMP_TYPE'..." + npm version "$STABLE_VERSION" --no-git-tag-version + npm version "$BUMP_TYPE" --no-git-tag-version fi -if [[ -n "$PRE_RELEASE" ]]; then - PUBLISH_ARGS+=(--tag next) +NEXT_VERSION=$(node -p "require('./package.json').version") +echo "Next target version computed: v$NEXT_VERSION" + +# 4. NPM Publish Execution +if [ "$DRY_RUN" = true ]; then + echo "🔍 [Dry Run] Skipping npm publish --tag $DIST_TAG" +else + echo "Publishing package to npm under tag: $DIST_TAG..." + npm publish --tag "$DIST_TAG" fi -npm publish "${PUBLISH_ARGS[@]}" -echo "Published to npm." +# 5. Stateless Changelog Generation (Strict SemVer Tracking) +echo "Calculating history interval to extract release notes..." + +PREVIOUS_TAG="" +for tag in $(git log --tags --simplify-by-decoration --pretty="format:%d" | grep -o 'tag: [^,)]*' | sed 's/tag: //'); do + if echo "$tag" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then + PREVIOUS_TAG="$tag" + break + fi +done + +# Generate release notes using the standalone changelog script +CHANGELOG_NOTES=$(./scripts/changelog.sh) + +if [ -z "$CHANGELOG_NOTES" ]; then + if [ "$FORCE_RELEASE" = true ]; then + echo "⚠️ Warning: No release notes (relnote comments) found since the last release tag ($PREVIOUS_TAG), but continuing due to --force flag." + CHANGELOG_NOTES="- Internal maintenance updates and chore improvements." + else + echo "❌ Error: No release notes (relnote comments) found since the last release tag ($PREVIOUS_TAG). Aborting release. Use --force to override." + exit 1 + fi +fi -echo "Pushing to GitHub..." -git push origin master --tags -echo "Pushed to GitHub." +echo "----------------- Generated Release Notes -----------------" +echo -e "$CHANGELOG_NOTES" +echo "-----------------------------------------------------------" -if [[ $PRE_RELEASE != "" ]]; then - echo "Published a pre-release version. Skipping post-release actions." - exit +# 6. Push Git Tag (Establish upstream state) +if [ "$DRY_RUN" = true ]; then + echo "🔍 [Dry Run] Skipping creation of tracking tag: v$NEXT_VERSION" +else + echo "Pushing lightweight tracking tag to origin..." + git tag "v$NEXT_VERSION" + git push origin "v$NEXT_VERSION" fi -if [[ $DRY_RUN != "" ]]; then - echo "All other commands are mutations, and we are doing a dry run." - echo "Terminating." - exit +# 7. Create GitHub Release +if [ "$DRY_RUN" = true ]; then + echo "🔍 [Dry Run] Skipping creation of GitHub Release." +else + echo "Generating GitHub Release notes..." + echo "$CHANGELOG_NOTES" > release_notes.md + + GH_RELEASE_FLAGS="" + if [ "$IS_PRERELEASE" = true ]; then + GH_RELEASE_FLAGS="--prerelease" + fi + + gh release create "v$NEXT_VERSION" \ + --repo "$ORG/$REPO" \ + --title "v$NEXT_VERSION" \ + --notes-file release_notes.md \ + $GH_RELEASE_FLAGS + + rm release_notes.md fi -echo "Cleaning up release notes..." -rm CHANGELOG.md -touch CHANGELOG.md -git commit -m "[firebase-release] Removed change log and reset repo after ${NEW_VERSION} release" CHANGELOG.md -echo "Cleaned up release notes." - -echo "Pushing to GitHub..." -# Push the changelog cleanup commit. -git push origin master --tags -echo "Pushed to GitHub." - -echo "Publishing release notes..." -hub release create --file "${RELEASE_NOTES_FILE}" "v${NEW_VERSION}" -echo "Published release notes." - -# Temporarily disable Twitter integration -#echo "Making the tweet..." -#npm install --no-save twitter@1.7.1 -#cp -v "${WDIR}/scripts/twitter.json" "${TEMPDIR}/${REPOSITORY_NAME}/scripts/" -#node ./scripts/tweet.js ${NEW_VERSION} -#echo "Made the tweet." +if [ "$DRY_RUN" = true ]; then + echo "🏁 Dry run completed successfully! No modifications were made to remote systems." +else + echo "🚀 Release of $PACKAGE_NAME@$NEXT_VERSION successfully completed!" +fi \ No newline at end of file diff --git a/scripts/publish/cloudbuild.yaml b/scripts/publish/cloudbuild.yaml index 10e4852a9..d3e491c53 100644 --- a/scripts/publish/cloudbuild.yaml +++ b/scripts/publish/cloudbuild.yaml @@ -12,19 +12,6 @@ steps: "--key=${_KEY_NAME}", ] - # Decrypt the Twitter credentials. - - name: "gcr.io/cloud-builders/gcloud" - args: - [ - "kms", - "decrypt", - "--ciphertext-file=twitter.json.enc", - "--plaintext-file=twitter.json", - "--location=global", - "--keyring=${_KEY_RING}", - "--key=${_KEY_NAME}", - ] - # Decrypt the npm credentials. - name: "gcr.io/cloud-builders/gcloud" args: @@ -55,6 +42,11 @@ steps: - name: "gcr.io/cloud-builders/git" args: ["clone", "git@github.com:${_REPOSITORY_ORG}/${_REPOSITORY_NAME}"] + # Fetch all tags so stateless history calculations resolve correctly. + - name: "gcr.io/cloud-builders/git" + dir: "${_REPOSITORY_NAME}" + args: ["fetch", "--tags"] + # Set up the Git configuration. - name: "gcr.io/cloud-builders/git" dir: "${_REPOSITORY_NAME}" @@ -63,11 +55,6 @@ steps: dir: "${_REPOSITORY_NAME}" args: ["config", "--global", "user.name", "Google Open Source Bot"] - # Set up the Twitter credentials. - - name: "gcr.io/$PROJECT_ID/package-builder" - entrypoint: "cp" - args: ["-v", "twitter.json", "${_REPOSITORY_NAME}/scripts/twitter.json"] - # Set up the npm credentials. - name: "gcr.io/$PROJECT_ID/package-builder" entrypoint: "bash" @@ -76,13 +63,23 @@ steps: # Publish the package. - name: "gcr.io/$PROJECT_ID/package-builder" dir: "${_REPOSITORY_NAME}" - args: ["bash", "./scripts/publish.sh", "${_VERSION}"] + entrypoint: bash + args: + - "-c" + - | + # Map our Cloud Build environment variables for the shell script execution + export GITHUB_TOKEN=$$GITHUB_TOKEN + + ./scripts/publish.sh ${_BUMP_TYPE} \ + ${_PRERELEASE:+--prerelease} \ + $([ "${_DRY_RUN}" = "false" ] && echo "--no-dry-run") \ + ${_FORCE:+--force} \ + ${_BRANCH:+--branch $_BRANCH} \ + --org=${_REPOSITORY_ORG} \ + --repository=${_REPOSITORY_NAME} \ + ${_DIST_TAG} + secretEnv: ["GITHUB_TOKEN"] - env: - - "REPOSITORY_ORG=${_REPOSITORY_ORG}" - - "REPOSITORY_NAME=${_REPOSITORY_NAME}" - - "DRY_RUN=${_DRY_RUN}" - - "PRE_RELEASE=${_PRE_RELEASE}" options: volumes: @@ -90,13 +87,17 @@ options: path: /root/.ssh substitutions: - _VERSION: "" - _PRE_RELEASE: "" - _DRY_RUN: "" + _BUMP_TYPE: "patch" + _PRERELEASE: "" + _DRY_RUN: "true" + _FORCE: "" + _DIST_TAG: "latest" _KEY_RING: "npm-publish-keyring" _KEY_NAME: "publish" _REPOSITORY_ORG: "firebase" _REPOSITORY_NAME: "firebase-functions" + _BRANCH: "" + _SDK: "" # Defaults to _REPOSITORY_NAME inside the script if left empty availableSecrets: secretManager: diff --git a/scripts/publish/twitter.json.enc b/scripts/publish/twitter.json.enc deleted file mode 100644 index 82123a04d..000000000 Binary files a/scripts/publish/twitter.json.enc and /dev/null differ diff --git a/scripts/tweet.js b/scripts/tweet.js deleted file mode 100644 index be6229574..000000000 --- a/scripts/tweet.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -const fs = require("fs"); -const Twitter = require("twitter"); - -function printUsage() { - console.error( - ` -Usage: tweet.js - -Credentials must be stored in "twitter.json" in this directory. - -Arguments: - - version: Version of module that was released. e.g. "1.2.3" -` - ); - process.exit(1); -} - -function getUrl(version) { - return `https://github.com/firebase/firebase-functions/releases/tag/v${version}`; -} - -if (process.argv.length !== 3) { - console.error("Missing arguments."); - printUsage(); -} - -const version = process.argv.pop(); -if (!version.match(/^\d+\.\d+\.\d+$/)) { - console.error(`Version "${version}" not a version number.`); - printUsage(); -} - -if (!fs.existsSync(`${__dirname}/twitter.json`)) { - console.error("Missing credentials."); - printUsage(); -} -const creds = require("./twitter.json"); - -const client = new Twitter(creds); - -client.post( - "statuses/update", - { status: `v${version} of @Firebase SDK for Cloud Functions is available. Release notes: ${getUrl(version)}` }, - (err) => { - if (err) { - console.error(err); - process.exit(1); - } - } -);