Skip to content

Publish release to PyPi #39

Publish release to PyPi

Publish release to PyPi #39

name: Publish release to PyPi
on:
release:
types: [published]
jobs:
build-wheel-and-tarball:
runs-on: ubuntu-latest
name: Build Logprep
steps:
- uses: actions/checkout@v3
- name: Initialize Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Build binary wheel and a source tarball
run: python setup.py sdist bdist_wheel
- name: Upload Artifact for next job
uses: actions/upload-artifact@master
with:
name: logprep-build
path: dist
publish-latest-release-to-pypi:
runs-on: ubuntu-latest
name: Publish release to PyPi
environment:
name: pypi
url: https://pypi.org/p/logprep
permissions:
id-token: write
needs: build-wheel-and-tarball
steps:
- name: Download artifact from previous job
uses: actions/download-artifact@master
with:
name: logprep-build
path: dist
- name: Publish package distributions to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
containerbuild:
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
needs: publish-latest-release-to-pypi
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v3
with:
push: true # Will only build if this is not here
build-args: |
LOGPREP_VERSION=${{ github.ref_name }}
PYTHON_VERSION=${{ matrix.python-version }}
tags: |
ghcr.io/fkie-cad/logprep:py${{ matrix.python-version }}-${{ github.ref_name }}
ghcr.io/fkie-cad/logprep:py${{ matrix.python-version }}-stable
ghcr.io/fkie-cad/logprep:py${{ matrix.python-version }}-latest