PyPI release fal #3
This file contains 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
name: PyPI release fal | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Version | |
required: false | |
default: patch | |
type: choice | |
options: | |
- patch | |
- minor | |
proto_version: | |
description: Version of isolate-proto to use. Empty means latest. | |
required: false | |
default: "" | |
type: string | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- name: Install poetry | |
shell: bash | |
run: pip install poetry-core=="1.4.*" poetry=="1.3.1" | |
- name: Add Datadog APP and API keys | |
working-directory: projects/fal | |
env: | |
DATADOG_API_KEY: ${{ secrets.FAL_SERVERLESS_CLI_DD_API_KEY }} | |
DATADOG_APP_KEY: ${{ secrets.FAL_SERVERLESS_CLI_DD_APP_KEY }} | |
run: | | |
cat << "EOF" > src/fal/env.py | |
from __future__ import annotations | |
CLI_ENV = "prod" | |
DATADOG_API_KEY = "${{ env.DATADOG_API_KEY }}" | |
DATADOG_APP_KEY = "${{ env.DATADOG_APP_KEY }}" | |
EOF | |
- name: Add the correct version of isolate-proto | |
working-directory: projects/fal | |
shell: bash | |
env: | |
ISOLATE_PROTO_VERSION: ${{ github.event.inputs.proto_version }} | |
run: | | |
echo "Adding isolate-proto version $ISOLATE_PROTO_VERSION" | |
tries=0 | |
# until makes it retry until the command succeeds | |
until poetry add --lock "isolate-proto==$ISOLATE_PROTO_VERSION" | |
do | |
tries=$((tries+1)) | |
if [ $tries -gt 3 ]; then | |
echo "Adding $PACKAGE failed too many times, aborting" | |
exit 1 | |
fi | |
echo "Adding $PACKAGE failed, retrying" | |
sleep 5 | |
done | |
- name: Bump publishing version and build | |
working-directory: projects/fal | |
env: | |
VERSION_TYPE: ${{ github.event.inputs.version }} | |
run: | | |
if [ -z "$VERSION_TYPE" ]; then | |
echo "Version is not set, defaulting to 'patch'" | |
VERSION_TYPE='patch' | |
fi | |
poetry version $VERSION_TYPE | |
poetry build | |
- name: Publish PyPI | |
env: | |
PYPI_USERNAME: ${{ secrets.PYPI_USER }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
working-directory: projects/fal | |
run: poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD -v -n | |
- name: Bump repo version | |
run: | | |
poetry version prerelease | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
branch: bump-fal-version | |
delete-branch: true | |
title: Bump the pyproject.toml version for fal | |
base: main | |
token: ${{ secrets.RELEASER_GITHUB_PAT }} |