-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setting up GitHub workflows for ci and release process
- Loading branch information
dittmar
committed
Feb 26, 2024
1 parent
d63bcc0
commit f3253cd
Showing
5 changed files
with
169 additions
and
54 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,29 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
pip install . |
This file was deleted.
Oops, something went wrong.
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,119 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release-type: | ||
type: choice | ||
description: 'Release type' | ||
required: true | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
deployment-env: | ||
type: choice | ||
description: 'Deployment environment' | ||
required: true | ||
options: | ||
- test.pypi.org | ||
- pypi.org | ||
default: 'test.pypi.org' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing to pypi.org and test.pypi.org | ||
|
||
steps: | ||
- uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ vars.DISY_RELEASE_APP_ID }} | ||
private-key: ${{ secrets.DISY_RELEASE_APP_SECRET }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
|
||
# version management | ||
- name: Install poetry | ||
run: | | ||
pipx install poetry | ||
poetry self add poetry-bumpversion | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install . | ||
- name: Build | ||
run: | | ||
poetry build | ||
# Needed for creating the tag | ||
- name: Configure Git | ||
run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
- name: Bump package version | ||
run: | | ||
echo "NEW_VERSION=$(poetry version ${{ github.event.inputs.release-type }})" >> $GITHUB_ENV | ||
echo "RELEASE_TAG=latest" >> $GITHUB_ENV | ||
# Update changelog unreleased section with new version | ||
- name: Update changelog | ||
uses: superfaceai/release-changelog-action@v2 | ||
with: | ||
path-to-changelog: CHANGELOG.md | ||
version: ${{ env.NEW_VERSION }} | ||
operation: release | ||
|
||
- name: Commit and tag changes | ||
run: | | ||
git add "pyproject.toml" | ||
git add "CHANGELOG.md" | ||
git commit -m "chore: release ${{ env.NEW_VERSION }}" | ||
git tag ${{ env.NEW_VERSION }} | ||
- name: Push changes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: git push origin && git push --tags | ||
|
||
- id: get-changelog | ||
name: Get version changelog | ||
uses: superfaceai/release-changelog-action@v2 | ||
with: | ||
path-to-changelog: CHANGELOG.md | ||
version: ${{ env.NEW_VERSION }} | ||
operation: read | ||
|
||
- name: Update GitHub release documentation | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.NEW_VERSION }} | ||
body: ${{ steps.get-changelog.outputs.changelog }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish package distributions to Test (!) PyPI | ||
if: "${{ github.event.inputs.deployment-env == 'test.pypi.org' }}" | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
|
||
- name: Publish package distributions to PyPI | ||
if: "${{ github.event.inputs.deployment-env == 'pypi.org' }}" | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
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,7 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## Unreleased |
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 |
---|---|---|
@@ -1,17 +1,18 @@ | ||
[build-system] | ||
requires = ["setuptools", "setuptools-scm"] | ||
build-backend = "setuptools.build_meta" | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[project] | ||
[tool.poetry] | ||
package-mode = true | ||
name = "cadenzaanalytics" | ||
authors = [ | ||
{name = "Julian Janßen", email = "[email protected]"} | ||
"Julian Janßen <[email protected]>", | ||
"Daniel Dittmar <[email protected]>" | ||
] | ||
dynamic = ["version"] | ||
version="0.1.1" | ||
description = "Official Python Package for creation of disy Cadenza analytics extensions" | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
license = { file = "LICENSE" } | ||
license = "Apache-2.0" | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Natural Language :: English", | ||
|
@@ -20,15 +21,13 @@ classifiers = [ | |
"Topic :: Scientific/Engineering", | ||
"Programming Language :: Python" | ||
] | ||
dependencies = [ | ||
"Flask>=2.2.2", | ||
"Flask-Cors>=3.0.10", | ||
"requests-toolbelt>=1.0.0", | ||
"pandas>=2.0.2" | ||
] | ||
|
||
[tool.setuptools_scm] | ||
local_scheme = "no-local-version" | ||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
Flask = "^2.2.2" | ||
Flask-Cors = "^3.0.10" | ||
requests-toolbelt = " ^1.0.0" | ||
pandas = " ^2.0.2" | ||
|
||
[project.urls] | ||
Repository = "https://github.com/DisyInformationssysteme/cadenza-analytics-python" |