Skip to content

Build and publish python package #652

Build and publish python package

Build and publish python package #652

Workflow file for this run

name: Build and publish python package
on:
workflow_call:
inputs:
python_version:
default: '3.11'
description: 'Python version to use'
required: false
type: string
workflow_dispatch:
inputs:
python_version:
default: '3.11'
description: 'Python version to use'
required: true
type: string
permissions: {}
jobs:
build-package:
runs-on: ubuntu-22.04
steps:
- name: Checkout arelle
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v5.0.0
with:
cache: 'pip'
check-latest: true
python-version: ${{ inputs.python_version }}
- name: Build python package
run: |
python -m pip install --upgrade pip setuptools wheel
pip install build
python -m build
- name: Upload tar artifact
uses: actions/upload-artifact@v3.1.3
with:
name: arelle.tar.gz
if-no-files-found: error
path: dist/*.tar.gz
- name: Upload wheel artifact
uses: actions/upload-artifact@v3.1.3
with:
name: arelle.whl
if-no-files-found: error
path: dist/*.whl
publish-package:
needs: build-package
environment: release
permissions:
contents: write
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Install twine
run: pip install -U twine
- name: Download tar artifact
uses: actions/download-artifact@v3.0.2
with:
name: arelle.tar.gz
- name: Download wheel artifact
uses: actions/download-artifact@v3.0.2
with:
name: arelle.whl
- name: Publish package on release
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_REPOSITORY: ${{ github.repository == 'Arelle/Arelle' && 'pypi' || 'testpypi' }}
run: twine upload ./*
- name: Upload release artifact
uses: softprops/action-gh-release@v0.1.15
with:
fail_on_unmatched_files: true
files: './*'