Skip to content

🚀 Deploy package to PyPI #27

🚀 Deploy package to PyPI

🚀 Deploy package to PyPI #27

Workflow file for this run

name: Deploy package to PyPI
on:
push:
branches: [ master ]
paths:
- musify/**
pull_request_target:
branches: [ master ]
paths:
- musify/**
workflow_dispatch:
permissions:
contents: read
env:
python-version: '3.12'
jobs:
lint:
name: Lint 🔎
runs-on: ubuntu-latest
steps:
- name: Checkout 🛒
uses: actions/checkout@v4
- name: Setup ⚙️ - Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Run flake8 🔎
uses: py-actions/flake8@v2
test:
name: Run tests 🧪
runs-on: ${{ matrix.os }}
needs: lint
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
name: Windows 🪟
- os: ubuntu-latest
name: Linux 🐧
python-version: [ '3.12' ]
- os: macos-latest
name: Mac 🍎
steps:
- name: Checkout 🛒
uses: actions/checkout@v4
- name: Setup ⚙️ - Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version || env.python-version }}
- name: Setup ⚙️ - Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install '.[test]'
- name: Run tests 🧪
run: |
pytest --junit-xml=test-results.xml
- name: Publish test results report 📃
if: always()
uses: pmeier/pytest-results-action@main
with:
path: test-results.xml
summary: true
display-options: fEX
fail-on-empty: true
title: Test results | ${{ matrix.name }} - Python${{ matrix.python-version }}
build:
name: Build package 📦
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout 🛒
uses: actions/checkout@v4
- name: Setup ⚙️ - Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Setup ⚙️ - Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install hatch
- name: Build package 🏗️
run: |
hatch build
- name: Upload package artifacts 📦
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
if-no-files-found: error
deploy:
name: Publish to PyPI 🚀
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch' }}
environment:
name: pypi
url: https://pypi.org/p/musify
permissions:
id-token: write
steps:
- name: Checkout 🛒
uses: actions/checkout@v4
- name: Download package artifacts 📦
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI 🚀
uses: pypa/gh-action-pypi-publish@release/v1