Skip to content

Commit

Permalink
Set up auto-publishing new releases on main (#10)
Browse files Browse the repository at this point in the history
* Try out auto-publishing

* Maybe fix

* whitespace

* Try again

* Maybe finally?

* Only run on main
  • Loading branch information
bm1549 authored Nov 26, 2021
1 parent b1a4595 commit e133b3d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 32 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/automatic-python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
push:
branches:
- main

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Required due to the weg Git works, without it this action won't be able to find any or the correct tags
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: 'Get next minor version'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.tag }}
strict: false
- name: 'Release new tag'
id: release-snapshot
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.semvers.outputs.patch }}
release_name: ${{ steps.semvers.outputs.patch }}
draft: false
prerelease: false
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish new release
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel --version ${{ steps.semvers.outputs.patch }}
twine upload dist/*
31 changes: 0 additions & 31 deletions .github/workflows/python-publish.yml

This file was deleted.

12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import setuptools
import sys

with open("README.md", "r") as fh:
long_description = fh.read()

# Default
version = "SNAPSHOT"

if "--version" in sys.argv:
idx = sys.argv.index("--version")
sys.argv.pop(idx)
version = sys.argv.pop(idx)

print("Using version " + version)

setuptools.setup(
name='frigidaire',
version='0.17',
version=version,
author="Brian Marks",
description="Python API for the Frigidaire 2.0 App",
license="MIT",
Expand Down

0 comments on commit e133b3d

Please sign in to comment.