Skip to content

Commit

Permalink
Action to build and publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmulqueen committed Oct 2, 2024
1 parent 8f09696 commit da5fa49
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python release

on:
release:
types: [published]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y dmtx-utils
python -m pip install --upgrade pip poetry
poetry install --with dev
- name: Test with pytest
run: |
poetry run pytest
release-build:
runs-on: ubuntu-latest

needs: test

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install Poetry
run: |
python -m pip install --upgrade pip poetry
- name: Build release distributions
run: |
poetry build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/


pypi-publish:
runs-on: ubuntu-latest

needs:
- release-build

permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

# Dedicated environments with protections for publishing are strongly recommended.
environment:
name: build
url: https://pypi.org/p/pyStrich

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit da5fa49

Please sign in to comment.