-
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.
- Loading branch information
desiena
committed
Dec 19, 2024
1 parent
6d8c9ab
commit 05e5ca9
Showing
2 changed files
with
38 additions
and
6 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Publish Python 🐍 distribution 📦 to PyPI | ||
name: Build and publish | ||
|
||
on: | ||
workflow_dispatch: | ||
|
@@ -7,6 +7,10 @@ on: | |
- main | ||
tags: | ||
- 'v*.*.*' # Example: v1.2.3 | ||
env: | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
PRE_RELEASE_VERSION: true | ||
DRAFT_VERSION: true | ||
|
||
jobs: | ||
build-and-publish: | ||
|
@@ -18,7 +22,30 @@ jobs: | |
id-token: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Sets env vars for main | ||
if: ${{ env.BRANCH_NAME == 'main' }} | ||
run: | | ||
echo "PRE_RELEASE_VERSION=false" >> $GITHUB_ENV | ||
echo "DRAFT_VERSION=false" >> $GITHUB_ENV | ||
- name: Get next version | ||
uses: reecetech/[email protected] | ||
id: version | ||
with: | ||
scheme: semver | ||
release_branch: main | ||
|
||
- name: Set PACKAGE_VERSION Environment Variable | ||
run: echo "PACKAGE_VERSION=${{ steps.version.outputs.version }}" >> $GITHUB_ENV | ||
|
||
- name: Release version | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
draft: ${{ env.DRAFT_VERSION }} | ||
prerelease: ${{ env.PRE_RELEASE_VERSION }} | ||
tag_name: "${{ steps.version.outputs.version }}" | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
|
@@ -41,15 +68,16 @@ jobs: | |
pip install -r requirements.txt | ||
# (Optional) Run tests | ||
# - name: Run tests | ||
# run: | | ||
# pytest | ||
# - name: Run tests | ||
# run: | | ||
# pytest | ||
|
||
# Build the package | ||
- name: Build package | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
- name: Publish package distributions to PyPI | ||
if: ${{ env.PRE_RELEASE_VERSION == false }} | ||
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 |
---|---|---|
@@ -1,11 +1,15 @@ | ||
import os | ||
|
||
from setuptools import setup | ||
|
||
with open('README.md', 'r', encoding='utf-8') as ld: | ||
long_description = ld.read() | ||
|
||
version = os.getenv('PACKAGE_VERSION', '0.0.1-dev') | ||
|
||
setup( | ||
name='fmdata', | ||
version='0.0.1', | ||
version=version, | ||
python_requires='>=3.8', | ||
author='Lorenzo De Siena', | ||
author_email='[email protected]', | ||
|