Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Github action for "release" and "publish_package" #152

Merged
merged 12 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
25 changes: 25 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 💥
labels:
- Semver-Major
- breaking-change
- title: Exciting New Features 🎉
labels:
- enhancement
- feature
- title: Bug Fix 🐛
labels:
- bug-fix
- title: Dependencies Update 📦
labels:
- dependencies
- title: Documentation 📝
labels:
- documentation
- title: Other Changes
labels:
- "*"
26 changes: 26 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
branches:
- gha-release
deep-volue marked this conversation as resolved.
Show resolved Hide resolved

name: Create Release

jobs:
create-github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Read version
id: read-version
run: |
version=$(<wapi/VERSION)
echo "VERSION=$version" >> "$GITHUB_OUTPUT"
echo "version is $version"
- name: Create Release
run: gh release create ${{ steps.read-version.outputs.VERSION }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/publish_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish package

on:
push:
branches:
- gha-release
deep-volue marked this conversation as resolved.
Show resolved Hide resolved

workflow_dispatch:
inputs:
version:
description: "Version to publish"
required: false
default: ""

jobs:
publish-package:
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3
with:
python-version: 3.11
deep-volue marked this conversation as resolved.
Show resolved Hide resolved

- run: pip install -U twine wheel

- name: Read version
id: read-version
run: |

# override VERSION file with input from dispatch action
if [ ${{ github.event_name }} == "workflow_dispatch" ]; then
version_input=${{ github.event.inputs.version }}
echo $version_input > wapi/VERSION
fi

version=$(<wapi/VERSION)
echo "VERSION=$version" >> "$GITHUB_OUTPUT"
echo "version is $version"

- name: Build dist
id: build-dist
run: |

VERSION=${{ steps.read-version.outputs.VERSION }}
rm -rf dist
python setup.py sdist bdist_wheel

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

here = os.path.abspath(os.path.dirname(__file__))
# Get current version from the VERSION file
with open(os.path.join(here, 'VERSION')) as fv:
with open(os.path.join(here, 'wapi/VERSION')) as fv:
version = fv.read()

install_requires = [
Expand Down
1 change: 1 addition & 0 deletions wapi/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.7.11dev1
6 changes: 4 additions & 2 deletions wapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#
# Wattsight API access library
#

import os
from .session import Session
from . import auth, curves, events, session, util

VERSION = __version__ = '0.7.11'
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'VERSION')) as fv:
VERSION = __version__ = fv.read().strip()
Dismissed Show dismissed Hide dismissed
Loading