Skip to content

Commit

Permalink
chore: add release automation (#235)
Browse files Browse the repository at this point in the history
* chore: add release automation

* chore: update cosmpy

* chore: add python 3.12 to CI tests

* chore: revert addition of Python 3.12
  • Loading branch information
jrriehl authored Mar 6, 2024
1 parent 3500a8f commit 925e198
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 96 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow is triggered when a PR is merged whose source branch's name starts with "release" and whose target branch is "main".
# It checks for the current package version (in pyproject.toml) and the latest tag on GitHub.
# If package version is more recent, it builds the project, uploads to PYPI, creates a Tag and makes a release on GitHub.
# Secrets PYPI_USERNAME and PYPI_PASSWORD are required!

name: Check and release
on:
pull_request:
branches: [main]
types: [closed]

jobs:
build:
name: Release
defaults:
run:
shell: bash

if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release')
runs-on: ubuntu-latest
steps:

- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Poetry
run: |
export POETRY_HOME=/opt/poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.4.0
$POETRY_HOME/bin/poetry --version
- name: Run release script
env:
PYPI_USERNAME: __token__
PYPI_PASSWORD: ${{ secrets.FETCHBOT_PYPI_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
run: |
pip install tomli packaging poetry
git config --global user.email "[email protected]"
git config --global user.name "CI BOT"
python3 ./scripts/do_release.py
Loading

0 comments on commit 925e198

Please sign in to comment.