python_test_project/.gitea/workflows/release.yml
Simon Diesenreiter 1b84f5064c
Some checks failed
CI / linter (ubuntu-latest, 3.9) (pull_request) Successful in 34s
SonarQube Scan / SonarQube Trigger (pull_request) Successful in 50s
CI / tests_linux (ubuntu-latest, 3.9) (pull_request) Successful in 38s
Upload Python Package / Create Release (push) Successful in 31s
Rename the project from template / rename-project (push) Successful in 25s
Upload Python Package / deploy (push) Failing after 43s
bugfix
2024-11-13 17:06:08 +01:00

64 lines
1.9 KiB
YAML

name: Upload Python Package
permissions:
contents: write
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
# by default, it uses a depth of 1
# this fetches all history so that we can read each commit
fetch-depth: 0
- name: Generate Changelog
run: .gitea/release_message.sh > release_message.md
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: release_message.md
deploy:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Check version match
run: |
REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $2}' | tr '-' '_' | tr '[:upper:]' '[:lower:]')
if [ "$(cat $REPOSITORY_NAME/VERSION)" = "${GITHUB_REF_NAME:1}" ] ; then
echo "Version matches successfully!"
else
echo "Version must match!"
return -1
fi
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
REPOSITORY_OWNER=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $1}')
python setup.py sdist bdist_wheel
twine upload --repository-url https://git.disi.dev/api/packages/$REPOSITORY_OWNER/pypi -u gitearobot -p ${{ secrets.PACKAGE_GITEA_PAT }} dist/*