-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add release automation (#235)
* 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
Showing
4 changed files
with
202 additions
and
96 deletions.
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,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 |
Oops, something went wrong.