Skip to content

Commit

Permalink
ci: Add release job
Browse files Browse the repository at this point in the history
Adds a CD job running on tag in charge of building the Python package
and pushing it to PyPI aswell as creating a GH release.
  • Loading branch information
simonkeyd committed Jun 11, 2022
1 parent 2b527e4 commit cc44114
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: release

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: '3.x'
architecture: 'x64'

- name: setup build env
run: |
python3 -m pip install --upgrade pip build twine
# - name: build & push
# env:
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
# run: |
# python3 -m build
# python3 -m twine upload --user "__token__" \
# --password "$PYPI_TOKEN" \
# --non-interactive \
# dist/*

- name: craft changelog
id: craft-changelog
run: |
echo "CHANGELOG<<MDR" >> $GITHUB_ENV
echo "## changelog" >> $GITHUB_ENV
if [[ $(git tag | wc -l) -ge 2 ]]; then
git_changelog_range="$(git describe --abbrev=0 ${GITHUB_REF}^)..$GITHUB_REF)"
fi
git log --pretty='%s ' ${git_changelog_range} >> $GITHUB_ENV
echo "MDR" >> $GITHUB_ENV
- name: gh-release
uses: softprops/action-gh-release@v1
with:
body: ${{ env.CHANGELOG }}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="bgcar",
version="0.0.1",
version="1.0.0",
author="simonkeyd",
author_email="simon.kheng1337@gmail.com",
license="GNU GPLv3",
Expand Down

0 comments on commit cc44114

Please sign in to comment.