Skip to content

chore: Update CI and build configurations #80

chore: Update CI and build configurations

chore: Update CI and build configurations #80

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
env:
PYTHON_VERSION: 3.x
jobs:
build-pkg:
name: Build Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry
- id: python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
- name: Install Dependencies
run: poetry install
- name: Build Package
run: poetry build
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: package
path: dist/*
build-exe:
name: Build Executable
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install GNU Softwares
uses: liblaf/install-action@main
with:
brew: coreutils gnu-sed make
choco: gnuwin32-coreutils.install make sed
- name: Install Poetry
run: pipx install poetry
- id: python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
- name: Install Dependencies
run: poetry install
- name: Build Executable
run: poetry run make dist
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-${{ runner.arch }}
path: dist/*
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
releases-created: ${{ steps.release.outputs.releases_created }}
tag-name: ${{ steps.release.outputs.tag_name }}
steps:
- id: release
name: Create GitHub Release
uses: google-github-actions/release-please-action@v3
with:
release-type: python
upload:
name: Upload Release Assets
needs:
- build-exe
- build-pkg
- release
if: needs.release.outputs.releases-created == 'true'
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Upload Release Assets
uses: softprops/action-gh-release@master
with:
tag_name: ${{ needs.release.outputs.tag-name }}
files: artifacts/**/*
publish:
name: Publish to PyPI
needs:
- release
if: needs.release.outputs.releases-created == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
- name: Install Dependencies
run: poetry install
- name: Publish to PyPI
run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}