Skip to content

Commit

Permalink
ci: add release and publish workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jyecusch committed Jun 25, 2021
1 parent f7f7195 commit 50f1d2f
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/draft_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
pull_request:
types: [closed]
branches:
- 'main'

jobs:
version:
if: github.event.pull_request.merged == true
name: Version and Draft Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub Draft Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
draft: true
prerelease: false
26 changes: 26 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish release to Pypi

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
token: ${{secrets.SUBMOD_PAT}}
submodules: recursive
fetch-depth: 0 # needed to retrieve most recent tag
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Build
run: make build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
token: ${{secrets.SUBMOD_PAT}}
submodules: recursive
#lfs: true
fetch-depth: 0 # needed to retrieve most recent tag
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_current_version_tag():
base_tag, num_commits = dev_tags.pop().split("-")[:2]
return "{}.dev{}".format(base_tag, num_commits)[1:]
else:
raise Exception("Unable to determine or construct version from git tags.")
return "0.0.0.dev0"


with open("README.md", "r") as readme_file:
Expand Down

0 comments on commit 50f1d2f

Please sign in to comment.