feat(ci/cd): Transition CI/CD to Forgejo for PyPI publishing

Migrated the CI/CD pipeline for PyPI package publishing from GitLab CI to Forgejo workflows. This change introduces a new `release.yml` workflow in the `.forgejo/workflows` directory, designed to trigger on tagged commits with a version identifier. The new workflow uses a Node.js container to manage the Python environment setup and package publication. By switching to Forgejo, we aim to consolidate CI/CD processes and improve integration within our development workflow.

This migration removes the previous `.gitlab-ci.yml` file, reflecting a shift away from GitLab CI in our project infrastructure.
This commit is contained in:
Kumi 2024-05-28 12:25:22 +02:00
parent 269e155f53
commit a8d1a8b4c3
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 32 additions and 20 deletions

View file

@ -0,0 +1,32 @@
name: Python Package CI/CD
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
publish:
name: Publish to PyPI
container:
image: node:20-bookworm
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt update
apt install -y python3 python3-venv
- name: Publish to PyPI
run: |
python3 -m venv venv
. ./venv/bin/activate
pip install -U hatchling twine build
python -m build .
python -m twine upload --username __token__ --password ${PYPI_TOKEN} dist/*
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

View file

@ -1,20 +0,0 @@
image: python:3.10
stages:
- publish
before_script:
- python -V
- python -m venv venv
- source venv/bin/activate
- pip install -U pip
- pip install .
publish:
stage: publish
script:
- pip install -U hatchling twine build
- python -m build .
- python -m twine upload --username __token__ --password ${PYPI_TOKEN} dist/*
only:
- tags