Skip to content

Commit e35a45a

Browse files
authored
chore: Implementing Pypi publish and Tweet steps (firebase#410)
* Updated release trigger mechanisms * Added license information to scripts * Added actions for publishing to Pypi and Twitter * Using shorter secret names; Pinned twitter action to a specific commit which seems to be safer
1 parent 5b244a2 commit e35a45a

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

.github/scripts/publish_preflight_check.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ echo_info ""
5959
readonly ABOUT_FILE="firebase_admin/__about__.py"
6060
echo_info "Loading version from: ${ABOUT_FILE}"
6161

62-
readonly VERSION_SCRIPT="exec(open('${ABOUT_FILE}').read()); print(__version__)"
63-
readonly RELEASE_VERSION=`python -c "${VERSION_SCRIPT}"` || true
62+
readonly RELEASE_VERSION=`grep "__version__" ${ABOUT_FILE} | awk '{print $3}' | tr -d \'` || true
6463
if [[ -z "${RELEASE_VERSION}" ]]; then
6564
echo_warn "Failed to extract release version from: ${ABOUT_FILE}"
6665
terminate

.github/workflows/release.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,6 @@ jobs:
101101
with:
102102
name: dist
103103

104-
# Python is needed to run Twine and some of the preflight checks.
105-
- name: Set up Python
106-
uses: actions/setup-python@v1
107-
with:
108-
python-version: 3.6
109-
110-
- name: Install dependencies
111-
run: |
112-
python -m pip install --upgrade pip
113-
pip install twine
114-
115104
- name: Publish preflight check
116105
id: preflight
117106
run: ./.github/scripts/publish_preflight_check.sh
@@ -131,11 +120,22 @@ jobs:
131120
prerelease: false
132121

133122
- name: Publish to Pypi
134-
run: echo Publishing to Pypi
123+
uses: pypa/[email protected]
124+
with:
125+
user: firebase
126+
password: ${{ secrets.PYPI_PASSWORD }}
135127

136128
# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
137129
- name: Post to Twitter
138130
if: success() &&
139131
contains(github.event.pull_request.labels.*.name, 'release:tweet')
140-
run: echo Posting Tweet
132+
uses: ethomson/send-tweet-action@288f9339e0412e3038dce350e0da5ecdf12133a6
133+
with:
134+
status: >
135+
${{ steps.preflight.outputs.version }} of @Firebase Admin Python SDK is avaialble.
136+
https://github.com/firebase/firebase-admin-python/releases/tag/${{ steps.preflight.outputs.version }}
137+
consumer-key: ${{ secrets.TWITTER_CONSUMER_KEY }}
138+
consumer-secret: ${{ secrets.TWITTER_CONSUMER_SECRET }}
139+
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
140+
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
141141
continue-on-error: true

0 commit comments

Comments
 (0)