Skip to content

Commit

Permalink
chore: specify package version based on github tag
Browse files Browse the repository at this point in the history
  • Loading branch information
meysam81 committed Jun 11, 2024
1 parent d83baab commit bba57a3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
38 changes: 21 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,6 @@ env:
PYTHON_VERSION: "3.12"

jobs:
publish-pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Prepare
run: pip install wheel && python setup.py sdist bdist_wheel
- name: Publish PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

build-docker-pr:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -182,7 +166,9 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: |
${{ steps.meta.outputs.tags }}
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ github.ref_name }}
- name: Docker Scout - cves
uses: docker/scout-action@v1
with:
Expand All @@ -199,3 +185,21 @@ jobs:
if-no-files-found: warn
name: scout-results
path: sarif.output.json

publish-pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- env:
PACKAGE_VERSION: ${{ github.ref_name }}
name: Prepare
run: pip install wheel && python setup.py sdist bdist_wheel
- name: Publish PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import os

from setuptools import find_packages, setup

# python3 setup.py bdist_wheel sdist

with open("README.md", "r") as fd:
LONG_DESCRIPTION = fd.read()

PACKAGE_VERSION = 1.0
PACKAGE_VERSION = os.environ.get("PACKAGE_VERSION", "0.0.1")

setup(
name="licenseware-logblocks",
Expand Down

0 comments on commit bba57a3

Please sign in to comment.