Skip to content

Commit

Permalink
Merge pull request #13 from fal-ai/make-gh-release
Browse files Browse the repository at this point in the history
ci: Add action for automatically creating releases
  • Loading branch information
isidentical authored Oct 10, 2022
2 parents d195cdc + 8ea7827 commit 60286bc
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 1 deletion.
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
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 }}
2 changes: 1 addition & 1 deletion pyproject.toml
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]>"]
Expand Down

0 comments on commit 60286bc

Please sign in to comment.