-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from fal-ai/make-gh-release
ci: Add action for automatically creating releases
- Loading branch information
Showing
2 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: PyPI Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Version | ||
required: false | ||
default: patch | ||
type: choice | ||
options: | ||
- patch | ||
- minor | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: Install poetry | ||
shell: bash | ||
run: pip install poetry-core=="1.0.*" poetry=="1.1.14" | ||
|
||
- name: Build isolate | ||
run: | | ||
VERSION_TYPE="${{ github.event.inputs.version }}" | ||
poetry version $VERSION_TYPE | ||
# version has format '0.4.1' | ||
current_version=$(poetry version -s) | ||
echo "current_version=$current_version" >> $GITHUB_ENV | ||
# tag has format 'v0.4.0' (note the 'v') | ||
prev_version_tag=$(git describe --tags --abbrev=0) | ||
echo "prev_version_tag=$prev_version_tag" >> $GITHUB_ENV | ||
poetry build | ||
- name: Generate a changelog | ||
uses: orhun/git-cliff-action@v1 | ||
id: git-cliff | ||
with: | ||
config: cliff.toml | ||
args: ${{ env.prev_version_tag }}..HEAD | ||
env: | ||
OUTPUT: CHANGES.md | ||
|
||
- name: Set the release body | ||
id: release | ||
shell: bash | ||
run: | | ||
r=$(cat ${{ steps.git-cliff.outputs.changelog }}) | ||
r="${r//'%'/'%25'}" # Multiline escape sequences for % | ||
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n' | ||
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r' | ||
echo "::set-output name=RELEASE_BODY::$r" | ||
- name: Publish GitHub | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: fal ${{ env.current_version }} | ||
body: ${{ steps.release.outputs.RELEASE_BODY }} | ||
tag_name: v${{ env.current_version }} | ||
files: | | ||
dist/fal-${{env.current_version}}-py3-none-any.whl | ||
dist/fal-${{env.current_version}}.tar.gz | ||
- name: Publish PyPI | ||
env: | ||
PYPI_USERNAME: __token__ | ||
PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD -v -n | ||
|
||
- name: Bump repo version | ||
run: | | ||
git clean -fxd # Clear all the changes | ||
poetry version ${{env.current_version}} | ||
poetry version prepatch | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
delete-branch: true | ||
title: Bump the pyproject.toml version | ||
base: main | ||
token: ${{ secrets.RELEASER_GITHUB_PAT }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "isolate" | ||
version = "0.1.0" | ||
version = "0.1.0-alpha.0" | ||
readme = "README.md" | ||
description = "Managed isolated environments for Python" | ||
authors = ["Features & Labels <[email protected]>"] | ||
|