From 118df450305b365032a2d85ed964f76202f3a751 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Tue, 25 Apr 2023 14:54:44 -0700 Subject: [PATCH 01/28] Fork firebase-admin python release scripts. --- .github/scripts/generate_changelog.sh | 79 +++++++++ .github/scripts/publish_preflight_check.sh | 183 +++++++++++++++++++++ setup.py | 11 +- src/firebase_functions/__init__.py | 2 + 4 files changed, 274 insertions(+), 1 deletion(-) create mode 100755 .github/scripts/generate_changelog.sh create mode 100755 .github/scripts/publish_preflight_check.sh diff --git a/.github/scripts/generate_changelog.sh b/.github/scripts/generate_changelog.sh new file mode 100755 index 0000000..af7a3d3 --- /dev/null +++ b/.github/scripts/generate_changelog.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# Copyright 2023 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e +set -u + +function printChangelog() { + local TITLE=$1 + shift + # Skip the sentinel value. + local ENTRIES=("${@:2}") + if [ ${#ENTRIES[@]} -ne 0 ]; then + echo "### ${TITLE}" + echo "" + for ((i = 0; i < ${#ENTRIES[@]}; i++)) + do + echo "* ${ENTRIES[$i]}" + done + echo "" + fi +} + +if [[ -z "${GITHUB_SHA}" ]]; then + GITHUB_SHA="HEAD" +fi + +LAST_TAG=`git describe --tags $(git rev-list --tags --max-count=1) 2> /dev/null` || true +if [[ -z "${LAST_TAG}" ]]; then + echo "[INFO] No tags found. Including all commits up to ${GITHUB_SHA}." + VERSION_RANGE="${GITHUB_SHA}" +else + echo "[INFO] Last release tag: ${LAST_TAG}." + COMMIT_SHA=`git show-ref -s ${LAST_TAG}` + echo "[INFO] Last release commit: ${COMMIT_SHA}." + VERSION_RANGE="${COMMIT_SHA}..${GITHUB_SHA}" + echo "[INFO] Including all commits in the range ${VERSION_RANGE}." +fi + +echo "" + +# Older versions of Bash (< 4.4) treat empty arrays as unbound variables, which triggers +# errors when referencing them. Therefore we initialize each of these arrays with an empty +# sentinel value, and later skip them. +CHANGES=("") +FIXES=("") +FEATS=("") +MISC=("") + +while read -r line +do + COMMIT_MSG=`echo ${line} | cut -d ' ' -f 2-` + if [[ $COMMIT_MSG =~ ^change(\(.*\))?: ]]; then + CHANGES+=("$COMMIT_MSG") + elif [[ $COMMIT_MSG =~ ^fix(\(.*\))?: ]]; then + FIXES+=("$COMMIT_MSG") + elif [[ $COMMIT_MSG =~ ^feat(\(.*\))?: ]]; then + FEATS+=("$COMMIT_MSG") + else + MISC+=("${COMMIT_MSG}") + fi +done < <(git log ${VERSION_RANGE} --oneline) + +printChangelog "Breaking Changes" "${CHANGES[@]}" +printChangelog "New Features" "${FEATS[@]}" +printChangelog "Bug Fixes" "${FIXES[@]}" +printChangelog "Miscellaneous" "${MISC[@]}" \ No newline at end of file diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh new file mode 100755 index 0000000..bf61816 --- /dev/null +++ b/.github/scripts/publish_preflight_check.sh @@ -0,0 +1,183 @@ +#!/bin/bash + +# Copyright 2023 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +###################################### Outputs ##################################### + +# 1. version: The version of this release including the 'v' prefix (e.g. v1.2.3). +# 2. changelog: Formatted changelog text for this release. + +#################################################################################### + +set -e +set -u + +function echo_info() { + local MESSAGE=$1 + echo "[INFO] ${MESSAGE}" +} + +function echo_warn() { + local MESSAGE=$1 + echo "[WARN] ${MESSAGE}" +} + +function terminate() { + echo "" + echo_warn "--------------------------------------------" + echo_warn "PREFLIGHT FAILED" + echo_warn "--------------------------------------------" + exit 1 +} + + +echo_info "Starting publish preflight check..." +echo_info "Git revision : ${GITHUB_SHA}" +echo_info "Workflow triggered by : ${GITHUB_ACTOR}" +echo_info "GitHub event : ${GITHUB_EVENT_NAME}" + + +echo_info "" +echo_info "--------------------------------------------" +echo_info "Extracting release version" +echo_info "--------------------------------------------" +echo_info "" + +readonly INIT_FILE="src/__init__.py" +echo_info "Loading version from: ${INIT_FILE}" + +readonly RELEASE_VERSION=`grep "__version__" ${INIT_FILE} | awk '{print $3}' | tr -d \'` || true +if [[ -z "${RELEASE_VERSION}" ]]; then + echo_warn "Failed to extract release version from: ${INIT_FILE}" + terminate +fi + +if [[ ! "${RELEASE_VERSION}" =~ ^([0-9]*)\.([0-9]*)\.([0-9]*)$ ]]; then + echo_warn "Malformed release version string: ${RELEASE_VERSION}. Exiting." + terminate +fi + +echo_info "Extracted release version: ${RELEASE_VERSION}" +echo "::set-output name=version::v${RELEASE_VERSION}" + + +echo_info "" +echo_info "--------------------------------------------" +echo_info "Check release artifacts" +echo_info "--------------------------------------------" +echo_info "" + +if [[ ! -d dist ]]; then + echo_warn "dist directory does not exist." + terminate +fi + +readonly BIN_DIST="dist/firebase_functions-${RELEASE_VERSION}-py3-none-any.whl" +if [[ -f "${BIN_DIST}" ]]; then + echo_info "Found binary distribution (bdist_wheel): ${BIN_DIST}" +else + echo_warn "Binary distribution ${BIN_DIST} not found." + terminate +fi + +readonly SRC_DIST="dist/firebase_functions-${RELEASE_VERSION}.tar.gz" +if [[ -f "${SRC_DIST}" ]]; then + echo_info "Found source distribution (sdist): ${SRC_DIST}" +else + echo_warn "Source distribution ${SRC_DIST} not found." + terminate +fi + +readonly ARTIFACT_COUNT=`ls dist/ | wc -l` +if [[ $ARTIFACT_COUNT -ne 2 ]]; then + echo_warn "Unexpected artifacts in the distribution directory." + ls -l dist + terminate +fi + + +echo_info "" +echo_info "--------------------------------------------" +echo_info "Checking previous releases" +echo_info "--------------------------------------------" +echo_info "" + +readonly PYPI_URL="https://pypi.org/pypi/firebase-functions/${RELEASE_VERSION}/json" +readonly PYPI_STATUS=`curl -s -o /dev/null -L -w "%{http_code}" ${PYPI_URL}` +if [[ $PYPI_STATUS -eq 404 ]]; then + echo_info "Release version ${RELEASE_VERSION} not found in Pypi." +elif [[ $PYPI_STATUS -eq 200 ]]; then + echo_warn "Release version ${RELEASE_VERSION} already present in Pypi." + terminate +else + echo_warn "Unexpected ${PYPI_STATUS} response from Pypi. Exiting." + terminate +fi + + +echo_info "" +echo_info "--------------------------------------------" +echo_info "Checking release tag" +echo_info "--------------------------------------------" +echo_info "" + +echo_info "---< git fetch --depth=1 origin +refs/tags/*:refs/tags/* >---" +git fetch --depth=1 origin +refs/tags/*:refs/tags/* +echo "" + +readonly EXISTING_TAG=`git rev-parse -q --verify "refs/tags/v${RELEASE_VERSION}"` || true +if [[ -n "${EXISTING_TAG}" ]]; then + echo_warn "Tag v${RELEASE_VERSION} already exists. Exiting." + echo_warn "If the tag was created in a previous unsuccessful attempt, delete it and try again." + echo_warn " $ git tag -d v${RELEASE_VERSION}" + echo_warn " $ git push --delete origin v${RELEASE_VERSION}" + + readonly RELEASE_URL="https://github.com/firebase/firebase-functions-python/releases/tag/v${RELEASE_VERSION}" + echo_warn "Delete any corresponding releases at ${RELEASE_URL}." + terminate +fi + +echo_info "Tag v${RELEASE_VERSION} does not exist." + + +echo_info "" +echo_info "--------------------------------------------" +echo_info "Generating changelog" +echo_info "--------------------------------------------" +echo_info "" + +echo_info "---< git fetch origin master --prune --unshallow >---" +git fetch origin master --prune --unshallow +echo "" + +echo_info "Generating changelog from history..." +readonly CURRENT_DIR=$(dirname "$0") +readonly CHANGELOG=`${CURRENT_DIR}/generate_changelog.sh` +echo "$CHANGELOG" + +# Parse and preformat the text to handle multi-line output. +# See https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/td-p/37870 +FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "\\[INFO\\]"` +FILTERED_CHANGELOG="${FILTERED_CHANGELOG//'%'/'%25'}" +FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\n'/'%0A'}" +FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\r'/'%0D'}" +echo "::set-output name=changelog::${FILTERED_CHANGELOG}" + + +echo "" +echo_info "--------------------------------------------" +echo_info "PREFLIGHT SUCCESSFUL" +echo_info "--------------------------------------------" \ No newline at end of file diff --git a/setup.py b/setup.py index b5033f8..a5391d8 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,7 @@ """ Setup for Firebase Functions Python. """ +from os import path from setuptools import find_packages, setup install_requires = [ @@ -30,9 +31,17 @@ 'google-cloud-tasks>=2.13.1' ] +# Read in the package metadata per recommendations from: +# https://packaging.python.org/guides/single-sourcing-package-version/ +init_path = path.join(path.dirname(path.abspath(__file__)), 'src', 'firebase_functions', '__init__.py') +version = {} +with open(init_path) as fp: + exec(fp.read(), version) # pylint: disable=exec-used + + setup( name='firebase_functions', - version='0.0.1', + version=version['__version__'], description='Firebase Functions Python SDK', install_requires=install_requires, extras_require={'dev': dev_requires}, diff --git a/src/firebase_functions/__init__.py b/src/firebase_functions/__init__.py index c598e1a..0b8cdf3 100644 --- a/src/firebase_functions/__init__.py +++ b/src/firebase_functions/__init__.py @@ -14,3 +14,5 @@ """ Firebase Functions for Python. """ + +__version__ = "0.0.1rc0" \ No newline at end of file From 6f6b7acc04eecc4804aff14627afd54157574be1 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Tue, 25 Apr 2023 14:56:33 -0700 Subject: [PATCH 02/28] Add release gh action. --- .github/workflows/release.yaml | 114 +++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..a5a61d6 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,114 @@ +# Copyright 2023 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Release Candidate + +on: + pull_request: + types: [opened, synchronize, closed] + # Allow workflow to be triggered manually. + workflow_dispatch: + +jobs: + stage_release: + # To publish a release, merge the release PR with the label 'release:publish'. + # To stage a release without publishing it, manually invoke the workflow. + # . or apply the 'release:stage' label to a PR. + if: (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:publish')) || + github.event.workflow_dispatch || + contains(github.event.pull_request.labels.*.name, 'release:stage') + + runs-on: ubuntu-latest + + # When manually triggering the build, the requester can specify a target branch or a tag + # via the 'ref' client parameter. + steps: + - name: Checkout source for staging + uses: actions/checkout@v2 + with: + ref: $GITHUB_REF + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.10 + + - name: Install dependencies + run: | + pip install --upgrade pip + python -m pip install -e ".[dev]" + + - name: Test with pytest & coverage + run: | + python -m pytest --cov=src --cov-report term --cov-report html --cov-report xml -vv + + # Build the Python Wheel and the source distribution. + - name: Package release artifacts + run: | + python -m pip install setuptools wheel + python setup.py bdist_wheel sdist + + # Attach the packaged artifacts to the workflow output. These can be manually + # downloaded for later inspection if necessary. + - name: Archive artifacts + uses: actions/upload-artifact@v1 + with: + name: dist + path: dist + + publish_release: + needs: stage_release + + # Check whether the release should be published. We publish only when the trigger PR is + # 1. merged + # 2. to the master branch + # 3. with the label 'release:publish', and + # 4. the title prefix '[chore] Release '. + if: github.event.pull_request.merged && + github.ref == 'master' && + contains(github.event.pull_request.labels.*.name, 'release:publish') && + startsWith(github.event.pull_request.title, '[chore] Release ') + + runs-on: ubuntu-latest + + steps: + - name: Checkout source for publish + uses: actions/checkout@v2 + + # Download the artifacts created by the stage_release job. + - name: Download release candidates + uses: actions/download-artifact@v1 + with: + name: dist + + - name: Publish preflight check + id: preflight + run: ./.github/scripts/publish_preflight_check.sh + + - name: Create release tag + uses: elgohr/Github-Release-Action@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.preflight.outputs.version }} + release_name: Firebase Admin Python SDK ${{ steps.preflight.outputs.version }} + body: ${{ steps.preflight.outputs.changelog }} + draft: false + prerelease: false + + - name: Publish to Pypi + uses: pypa/gh-action-pypi-publish@v1.0.0a0 + with: + user: firebase + password: ${{ secrets.PYPI_PASSWORD }} \ No newline at end of file From ed09ed7d06546e7a317ee77b2c90668945f56a10 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Tue, 25 Apr 2023 14:59:38 -0700 Subject: [PATCH 03/28] Make linter happy. --- src/firebase_functions/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firebase_functions/__init__.py b/src/firebase_functions/__init__.py index 0b8cdf3..1a4c656 100644 --- a/src/firebase_functions/__init__.py +++ b/src/firebase_functions/__init__.py @@ -15,4 +15,4 @@ Firebase Functions for Python. """ -__version__ = "0.0.1rc0" \ No newline at end of file +__version__ = "0.0.1rc0" From b92844404cbe054760de6aa62f26f3078fd442fc Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Tue, 25 Apr 2023 14:59:50 -0700 Subject: [PATCH 04/28] Use latest version of checkout. --- .github/workflows/release.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a5a61d6..d477e5f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,9 +35,7 @@ jobs: # via the 'ref' client parameter. steps: - name: Checkout source for staging - uses: actions/checkout@v2 - with: - ref: $GITHUB_REF + uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 From 1f80deb90aed3e2ff24243f493555a81f1b86007 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Tue, 25 Apr 2023 15:01:02 -0700 Subject: [PATCH 05/28] yaml does not like floating point numbers. --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d477e5f..4be5f66 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -40,7 +40,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.10 + python-version: '3.10' - name: Install dependencies run: | From b16be1eb0838baafc9eacd0ec50ca29465cdbdea Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 13:22:45 -0700 Subject: [PATCH 06/28] Update release scripts. --- .github/scripts/generate_changelog.sh | 6 ++++++ .github/scripts/publish_preflight_check.sh | 4 ++-- .github/workflows/release.yaml | 9 +++++---- setup.py | 8 ++++++-- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/scripts/generate_changelog.sh b/.github/scripts/generate_changelog.sh index af7a3d3..75a73ff 100755 --- a/.github/scripts/generate_changelog.sh +++ b/.github/scripts/generate_changelog.sh @@ -66,8 +66,14 @@ do CHANGES+=("$COMMIT_MSG") elif [[ $COMMIT_MSG =~ ^fix(\(.*\))?: ]]; then FIXES+=("$COMMIT_MSG") + elif [[ $COMMIT_MSG =~ ^chore(\(.*\))?: ]]; then + FIXES+=("$COMMIT_MSG") + elif [[ $COMMIT_MSG =~ ^refactor(\(.*\))?: ]]; then + FIXES+=("$COMMIT_MSG") elif [[ $COMMIT_MSG =~ ^feat(\(.*\))?: ]]; then FEATS+=("$COMMIT_MSG") + elif [[ $COMMIT_MSG =~ ^Merge\ branch(\(.*\))?: ]]; then + : # do nothing else MISC+=("${COMMIT_MSG}") fi diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index bf61816..86f0876 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -56,7 +56,7 @@ echo_info "Extracting release version" echo_info "--------------------------------------------" echo_info "" -readonly INIT_FILE="src/__init__.py" +readonly INIT_FILE="src/firebase-functions/__init__.py" echo_info "Loading version from: ${INIT_FILE}" readonly RELEASE_VERSION=`grep "__version__" ${INIT_FILE} | awk '{print $3}' | tr -d \'` || true @@ -65,7 +65,7 @@ if [[ -z "${RELEASE_VERSION}" ]]; then terminate fi -if [[ ! "${RELEASE_VERSION}" =~ ^([0-9]*)\.([0-9]*)\.([0-9]*)$ ]]; then +if [[ ! "${RELEASE_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([a-zA-Z0-9_\-\.]+)?$ ]]; then echo_warn "Malformed release version string: ${RELEASE_VERSION}. Exiting." terminate fi diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4be5f66..0f9914a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -31,8 +31,6 @@ jobs: runs-on: ubuntu-latest - # When manually triggering the build, the requester can specify a target branch or a tag - # via the 'ref' client parameter. steps: - name: Checkout source for staging uses: actions/checkout@v3 @@ -95,12 +93,14 @@ jobs: run: ./.github/scripts/publish_preflight_check.sh - name: Create release tag + # Skip creating a release tag for prereleases + if: (!contains(github.event.pull_request.labels.*.name, 'release:prerelease')) uses: elgohr/Github-Release-Action@v4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ steps.preflight.outputs.version }} - release_name: Firebase Admin Python SDK ${{ steps.preflight.outputs.version }} + release_name: Firebase Functions Python SDK ${{ steps.preflight.outputs.version }} body: ${{ steps.preflight.outputs.changelog }} draft: false prerelease: false @@ -109,4 +109,5 @@ jobs: uses: pypa/gh-action-pypi-publish@v1.0.0a0 with: user: firebase - password: ${{ secrets.PYPI_PASSWORD }} \ No newline at end of file + password: ${{ secrets.PYPI_PASSWORD }} + repository_url: https://test.pypi.org/legacy/ \ No newline at end of file diff --git a/setup.py b/setup.py index a5391d8..95c27ab 100644 --- a/setup.py +++ b/setup.py @@ -38,20 +38,24 @@ with open(init_path) as fp: exec(fp.read(), version) # pylint: disable=exec-used - setup( name='firebase_functions', version=version['__version__'], description='Firebase Functions Python SDK', + url='https://github.com/firebase/firebase-functions-python', + author='Firebase Team', + keywords=['firebase', 'functions', 'google', 'cloud'], + license='Apache License 2.0', install_requires=install_requires, extras_require={'dev': dev_requires}, packages=find_packages(where='src'), package_dir={'': 'src'}, python_requires='>=3.10', classifiers=[ - 'Development Status :: 1 - Planning', + 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Topic :: Software Development :: Build Tools', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', ], ) From 9b63e41799d0ff9914d13b5c28d0bb7610d34df8 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 13:32:31 -0700 Subject: [PATCH 07/28] Fix formatting. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 95c27ab..1640719 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,8 @@ # Read in the package metadata per recommendations from: # https://packaging.python.org/guides/single-sourcing-package-version/ -init_path = path.join(path.dirname(path.abspath(__file__)), 'src', 'firebase_functions', '__init__.py') +init_path = path.join(path.dirname(path.abspath(__file__)), 'src', + 'firebase_functions', '__init__.py') version = {} with open(init_path) as fp: exec(fp.read(), version) # pylint: disable=exec-used From b0224cdaa1dee4c3fb1c80740d197913e8da18c0 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 13:58:44 -0700 Subject: [PATCH 08/28] Update releas script. --- .github/workflows/release.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0f9914a..8aeffdf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -106,8 +106,7 @@ jobs: prerelease: false - name: Publish to Pypi - uses: pypa/gh-action-pypi-publish@v1.0.0a0 + uses: pypa/gh-action-pypi-publish@release/v1 with: user: firebase - password: ${{ secrets.PYPI_PASSWORD }} - repository_url: https://test.pypi.org/legacy/ \ No newline at end of file + password: ${{ secrets.PYPI_PASSWORD }} \ No newline at end of file From 8ccd424d894a5bb8b2dd500a75588d17e702b70c Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 14:14:57 -0700 Subject: [PATCH 09/28] Temporarily enable publish job for debugging. --- .github/workflows/release.yaml | 36 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8aeffdf..9856221 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -71,10 +71,11 @@ jobs: # 2. to the master branch # 3. with the label 'release:publish', and # 4. the title prefix '[chore] Release '. - if: github.event.pull_request.merged && - github.ref == 'master' && - contains(github.event.pull_request.labels.*.name, 'release:publish') && - startsWith(github.event.pull_request.title, '[chore] Release ') + # if: github.event.pull_request.merged && + # github.ref == 'master' && + # contains(github.event.pull_request.labels.*.name, 'release:publish') && + # startsWith(github.event.pull_request.title, '[chore] Release ') + if: (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:publish')) runs-on: ubuntu-latest @@ -92,21 +93,22 @@ jobs: id: preflight run: ./.github/scripts/publish_preflight_check.sh - - name: Create release tag - # Skip creating a release tag for prereleases - if: (!contains(github.event.pull_request.labels.*.name, 'release:prerelease')) - uses: elgohr/Github-Release-Action@v4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.preflight.outputs.version }} - release_name: Firebase Functions Python SDK ${{ steps.preflight.outputs.version }} - body: ${{ steps.preflight.outputs.changelog }} - draft: false - prerelease: false + # - name: Create release tag + # # Skip creating a release tag for prereleases + # if: (!contains(github.event.pull_request.labels.*.name, 'release:prerelease')) + # uses: elgohr/Github-Release-Action@v4 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: ${{ steps.preflight.outputs.version }} + # release_name: Firebase Functions Python SDK ${{ steps.preflight.outputs.version }} + # body: ${{ steps.preflight.outputs.changelog }} + # draft: false + # prerelease: false - name: Publish to Pypi uses: pypa/gh-action-pypi-publish@release/v1 with: user: firebase - password: ${{ secrets.PYPI_PASSWORD }} \ No newline at end of file + password: ${{ secrets.PYPI_PASSWORD }} + repository-url: https://test.pypi.org/legacy/ \ No newline at end of file From 57da2683886cec806c7c42f8b9fe658b21c2e965 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 14:16:50 -0700 Subject: [PATCH 10/28] Actually enable publish job. --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9856221..b6cda62 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -75,7 +75,7 @@ jobs: # github.ref == 'master' && # contains(github.event.pull_request.labels.*.name, 'release:publish') && # startsWith(github.event.pull_request.title, '[chore] Release ') - if: (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:publish')) + if: contains(github.event.pull_request.labels.*.name, 'release:stage') runs-on: ubuntu-latest From f247921f0ff0fd95d2e0f9e195f9e7db859516ad Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 14:22:13 -0700 Subject: [PATCH 11/28] Fix typo on preflight script. --- .github/scripts/publish_preflight_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index 86f0876..8ab9adb 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -56,7 +56,7 @@ echo_info "Extracting release version" echo_info "--------------------------------------------" echo_info "" -readonly INIT_FILE="src/firebase-functions/__init__.py" +readonly INIT_FILE="src/firebase_functions/__init__.py" echo_info "Loading version from: ${INIT_FILE}" readonly RELEASE_VERSION=`grep "__version__" ${INIT_FILE} | awk '{print $3}' | tr -d \'` || true From 0a8bbdc2d34a7f978fd4af598e96c7e81ce2d952 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 14:35:54 -0700 Subject: [PATCH 12/28] More fixes to the preflight script. --- .github/scripts/publish_preflight_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index 8ab9adb..a8797eb 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -65,7 +65,7 @@ if [[ -z "${RELEASE_VERSION}" ]]; then terminate fi -if [[ ! "${RELEASE_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([a-zA-Z0-9_\-\.]+)?$ ]]; then +if [[ ! "${RELEASE_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([a-zA-Z0-9]+)?$ ]]; then echo_warn "Malformed release version string: ${RELEASE_VERSION}. Exiting." terminate fi From 8e2764d578d423ebfb16a231333714ee97aa9d43 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 14:50:00 -0700 Subject: [PATCH 13/28] Fix more things. --- .github/scripts/publish_preflight_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index a8797eb..ceca7bb 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -59,7 +59,7 @@ echo_info "" readonly INIT_FILE="src/firebase_functions/__init__.py" echo_info "Loading version from: ${INIT_FILE}" -readonly RELEASE_VERSION=`grep "__version__" ${INIT_FILE} | awk '{print $3}' | tr -d \'` || true +readonly RELEASE_VERSION=`grep "__version__" ${INIT_FILE} | awk '{print $3}' | tr -d \"` || true if [[ -z "${RELEASE_VERSION}" ]]; then echo_warn "Failed to extract release version from: ${INIT_FILE}" terminate From 714a992876aa1dcc219ff3f5c3859fa7490a41ae Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 14:57:02 -0700 Subject: [PATCH 14/28] migrate from deprecated set-output commands. --- .github/scripts/publish_preflight_check.sh | 4 ++-- .github/workflows/release.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index ceca7bb..9895208 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -71,7 +71,7 @@ if [[ ! "${RELEASE_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([a-zA-Z0-9]+)?$ ]]; then fi echo_info "Extracted release version: ${RELEASE_VERSION}" -echo "::set-output name=version::v${RELEASE_VERSION}" +echo "version=${RELEASE_VERSION}" >> "$GITHUB_ENV" echo_info "" @@ -174,7 +174,7 @@ FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "\\[INFO\\]"` FILTERED_CHANGELOG="${FILTERED_CHANGELOG//'%'/'%25'}" FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\n'/'%0A'}" FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\r'/'%0D'}" -echo "::set-output name=changelog::${FILTERED_CHANGELOG}" +echo "changelog=${FILTERED_CHANGELOG}" >> "$GITHUB_ENV" echo "" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b6cda62..bad4305 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -100,9 +100,9 @@ jobs: # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # with: - # tag_name: ${{ steps.preflight.outputs.version }} - # release_name: Firebase Functions Python SDK ${{ steps.preflight.outputs.version }} - # body: ${{ steps.preflight.outputs.changelog }} + # tag_name: ${{ env.version }} + # release_name: Firebase Functions Python SDK ${{ env.version }} + # body: ${{ env.changelog }} # draft: false # prerelease: false From a02738f696d4243f90d39562a90cdd12ac8c1f41 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 14:57:42 -0700 Subject: [PATCH 15/28] Fix another preflight script bug. --- .github/scripts/publish_preflight_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index 9895208..8c8aaf4 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -160,7 +160,7 @@ echo_info "--------------------------------------------" echo_info "" echo_info "---< git fetch origin master --prune --unshallow >---" -git fetch origin master --prune --unshallow +git fetch origin main --unshallow echo "" echo_info "Generating changelog from history..." From 8550fb89a053a05ca49a71b379b4177587bacc13 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:00:11 -0700 Subject: [PATCH 16/28] Fix another preflight script bug. --- .github/scripts/publish_preflight_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index 8c8aaf4..493f45f 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -160,7 +160,7 @@ echo_info "--------------------------------------------" echo_info "" echo_info "---< git fetch origin master --prune --unshallow >---" -git fetch origin main --unshallow +git fetch origin main echo "" echo_info "Generating changelog from history..." From 488625eed938b42a6b849a272812cfa33bfc42be Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:05:21 -0700 Subject: [PATCH 17/28] More diagnostics please. --- .github/scripts/publish_preflight_check.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index 493f45f..b2ea5f0 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -24,6 +24,8 @@ set -e set -u +set -o pipefail +set -x function echo_info() { local MESSAGE=$1 @@ -159,7 +161,7 @@ echo_info "Generating changelog" echo_info "--------------------------------------------" echo_info "" -echo_info "---< git fetch origin master --prune --unshallow >---" +echo_info "---< git fetch origin main >---" git fetch origin main echo "" From 5f21c8276970c9e233fc2a628a1b1abd5539eeb5 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:07:49 -0700 Subject: [PATCH 18/28] Remove git fetch instr. --- .github/scripts/publish_preflight_check.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index b2ea5f0..a380967 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -136,10 +136,6 @@ echo_info "Checking release tag" echo_info "--------------------------------------------" echo_info "" -echo_info "---< git fetch --depth=1 origin +refs/tags/*:refs/tags/* >---" -git fetch --depth=1 origin +refs/tags/*:refs/tags/* -echo "" - readonly EXISTING_TAG=`git rev-parse -q --verify "refs/tags/v${RELEASE_VERSION}"` || true if [[ -n "${EXISTING_TAG}" ]]; then echo_warn "Tag v${RELEASE_VERSION} already exists. Exiting." From 24c675054cf73880ca323606eb62723b2db2c645 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:13:40 -0700 Subject: [PATCH 19/28] Add long_description --- setup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup.py b/setup.py index 1640719..d90d1e7 100644 --- a/setup.py +++ b/setup.py @@ -39,10 +39,14 @@ with open(init_path) as fp: exec(fp.read(), version) # pylint: disable=exec-used +long_description = ('The Firebase Functions Python SDK provides an SDK for defining' + 'Cloud Functions for Firebase.') + setup( name='firebase_functions', version=version['__version__'], description='Firebase Functions Python SDK', + long_description=long_description, url='https://github.com/firebase/firebase-functions-python', author='Firebase Team', keywords=['firebase', 'functions', 'google', 'cloud'], From 13a52ba767cc159dd6bbc4013c5fbd432a11dee0 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:16:50 -0700 Subject: [PATCH 20/28] Use personal test account instead. --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bad4305..fb8be6c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -109,6 +109,6 @@ jobs: - name: Publish to Pypi uses: pypa/gh-action-pypi-publish@release/v1 with: - user: firebase - password: ${{ secrets.PYPI_PASSWORD }} + user: danielylee + password: ${{ secrets.TEST_PYPI_PASSWORD }} repository-url: https://test.pypi.org/legacy/ \ No newline at end of file From 40922e8e9096229506f68dce7d740ccf287bb9c6 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:19:43 -0700 Subject: [PATCH 21/28] Fix formatting. --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d90d1e7..679cdab 100644 --- a/setup.py +++ b/setup.py @@ -39,8 +39,9 @@ with open(init_path) as fp: exec(fp.read(), version) # pylint: disable=exec-used -long_description = ('The Firebase Functions Python SDK provides an SDK for defining' - 'Cloud Functions for Firebase.') +long_description = ( + 'The Firebase Functions Python SDK provides an SDK for defining' + 'Cloud Functions for Firebase.') setup( name='firebase_functions', From acc68c08448246d248be117c78ae40459c26c38f Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:22:37 -0700 Subject: [PATCH 22/28] Update action versions. --- .github/workflows/release.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fb8be6c..7ab31ef 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -58,10 +58,10 @@ jobs: # Attach the packaged artifacts to the workflow output. These can be manually # downloaded for later inspection if necessary. - name: Archive artifacts - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: dist - path: dist + path: dist/ publish_release: needs: stage_release @@ -81,11 +81,11 @@ jobs: steps: - name: Checkout source for publish - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Download the artifacts created by the stage_release job. - name: Download release candidates - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v3 with: name: dist From 9a902155b992c5f81e39dde62f00dce29403a6fa Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:27:13 -0700 Subject: [PATCH 23/28] Fix issue with artifact download upgrade. --- .github/scripts/publish_preflight_check.sh | 2 -- .github/workflows/release.yaml | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index a380967..55ed7b6 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -24,8 +24,6 @@ set -e set -u -set -o pipefail -set -x function echo_info() { local MESSAGE=$1 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7ab31ef..c323df0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -88,6 +88,7 @@ jobs: uses: actions/download-artifact@v3 with: name: dist + path: dist - name: Publish preflight check id: preflight From aa76735824b8ff6ace62b37affb459a4284a5576 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:29:38 -0700 Subject: [PATCH 24/28] Fix typo on long description --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 679cdab..f1fc72a 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ long_description = ( 'The Firebase Functions Python SDK provides an SDK for defining' - 'Cloud Functions for Firebase.') + ' Cloud Functions for Firebase.') setup( name='firebase_functions', From e92438300cedd12e9f10fc7bcb71147399174155 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:32:33 -0700 Subject: [PATCH 25/28] Test done. Bring back 'prod' release script. --- .github/workflows/release.yaml | 38 ++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c323df0..f10e26d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -71,11 +71,10 @@ jobs: # 2. to the master branch # 3. with the label 'release:publish', and # 4. the title prefix '[chore] Release '. - # if: github.event.pull_request.merged && - # github.ref == 'master' && - # contains(github.event.pull_request.labels.*.name, 'release:publish') && - # startsWith(github.event.pull_request.title, '[chore] Release ') - if: contains(github.event.pull_request.labels.*.name, 'release:stage') + if: github.event.pull_request.merged && + github.ref == 'master' && + contains(github.event.pull_request.labels.*.name, 'release:publish') && + startsWith(github.event.pull_request.title, '[chore] Release ') runs-on: ubuntu-latest @@ -94,22 +93,21 @@ jobs: id: preflight run: ./.github/scripts/publish_preflight_check.sh - # - name: Create release tag - # # Skip creating a release tag for prereleases - # if: (!contains(github.event.pull_request.labels.*.name, 'release:prerelease')) - # uses: elgohr/Github-Release-Action@v4 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # tag_name: ${{ env.version }} - # release_name: Firebase Functions Python SDK ${{ env.version }} - # body: ${{ env.changelog }} - # draft: false - # prerelease: false + - name: Create release tag + # Skip creating a release tag for prereleases + if: (!contains(github.event.pull_request.labels.*.name, 'release:prerelease')) + uses: elgohr/Github-Release-Action@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.version }} + release_name: Firebase Functions Python SDK ${{ env.version }} + body: ${{ env.changelog }} + draft: false + prerelease: false - name: Publish to Pypi uses: pypa/gh-action-pypi-publish@release/v1 with: - user: danielylee - password: ${{ secrets.TEST_PYPI_PASSWORD }} - repository-url: https://test.pypi.org/legacy/ \ No newline at end of file + user: firebase + password: ${{ secrets.PYPI_PASSWORD }} \ No newline at end of file From fb9eb29c4c0af8674b840f389e3019e5626fca0b Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:43:02 -0700 Subject: [PATCH 26/28] Fixup changelog. --- .github/scripts/generate_changelog.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/scripts/generate_changelog.sh b/.github/scripts/generate_changelog.sh index 75a73ff..c4c77f6 100755 --- a/.github/scripts/generate_changelog.sh +++ b/.github/scripts/generate_changelog.sh @@ -66,14 +66,10 @@ do CHANGES+=("$COMMIT_MSG") elif [[ $COMMIT_MSG =~ ^fix(\(.*\))?: ]]; then FIXES+=("$COMMIT_MSG") - elif [[ $COMMIT_MSG =~ ^chore(\(.*\))?: ]]; then - FIXES+=("$COMMIT_MSG") elif [[ $COMMIT_MSG =~ ^refactor(\(.*\))?: ]]; then FIXES+=("$COMMIT_MSG") elif [[ $COMMIT_MSG =~ ^feat(\(.*\))?: ]]; then FEATS+=("$COMMIT_MSG") - elif [[ $COMMIT_MSG =~ ^Merge\ branch(\(.*\))?: ]]; then - : # do nothing else MISC+=("${COMMIT_MSG}") fi @@ -81,5 +77,4 @@ done < <(git log ${VERSION_RANGE} --oneline) printChangelog "Breaking Changes" "${CHANGES[@]}" printChangelog "New Features" "${FEATS[@]}" -printChangelog "Bug Fixes" "${FIXES[@]}" -printChangelog "Miscellaneous" "${MISC[@]}" \ No newline at end of file +printChangelog "Bug Fixes" "${FIXES[@]}" \ No newline at end of file From 0e46d862f06bfae118841ec0d67b3ea577d1adcd Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:46:37 -0700 Subject: [PATCH 27/28] Fix use of step output. --- .github/scripts/publish_preflight_check.sh | 4 ++-- .github/workflows/release.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index 55ed7b6..f47996a 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -71,7 +71,7 @@ if [[ ! "${RELEASE_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([a-zA-Z0-9]+)?$ ]]; then fi echo_info "Extracted release version: ${RELEASE_VERSION}" -echo "version=${RELEASE_VERSION}" >> "$GITHUB_ENV" +echo "version=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT" echo_info "" @@ -170,7 +170,7 @@ FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "\\[INFO\\]"` FILTERED_CHANGELOG="${FILTERED_CHANGELOG//'%'/'%25'}" FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\n'/'%0A'}" FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\r'/'%0D'}" -echo "changelog=${FILTERED_CHANGELOG}" >> "$GITHUB_ENV" +echo "changelog=${FILTERED_CHANGELOG}" >> "$GITHUB_OUTPUT" echo "" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f10e26d..ec52733 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -100,9 +100,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ env.version }} - release_name: Firebase Functions Python SDK ${{ env.version }} - body: ${{ env.changelog }} + tag_name: ${{ steps.preflight.outputs.version }} + release_name: Firebase Functions Python SDK ${{ steps.preflight.outputs.version }} + body: ${{ steps.preflight.outputs.changelog }} draft: false prerelease: false From cb3f34e8b23d43d4e80aaa49fe6468ef0d7bd74e Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 26 Apr 2023 15:55:20 -0700 Subject: [PATCH 28/28] Fix multiline string step outputs. --- .github/scripts/publish_preflight_check.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/scripts/publish_preflight_check.sh b/.github/scripts/publish_preflight_check.sh index f47996a..e467fab 100755 --- a/.github/scripts/publish_preflight_check.sh +++ b/.github/scripts/publish_preflight_check.sh @@ -165,12 +165,12 @@ readonly CHANGELOG=`${CURRENT_DIR}/generate_changelog.sh` echo "$CHANGELOG" # Parse and preformat the text to handle multi-line output. -# See https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/td-p/37870 +https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "\\[INFO\\]"` -FILTERED_CHANGELOG="${FILTERED_CHANGELOG//'%'/'%25'}" -FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\n'/'%0A'}" -FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\r'/'%0D'}" -echo "changelog=${FILTERED_CHANGELOG}" >> "$GITHUB_OUTPUT" +EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) +echo "changelog=<<$EOF" >> "$GITHUB_OUTPUT" +echo $CHANGELOG >> "$GITHUB_OUTPUT" +echo $EOF >> "$GITHUG_OUTPUT" echo ""