-
Notifications
You must be signed in to change notification settings - Fork 60
103 lines (99 loc) · 2.89 KB
/
python-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Build and publish Python package
on:
workflow_call:
inputs:
node_version:
default: '22'
description: 'Node version to use'
required: false
type: string
python_version:
default: '3.12'
description: 'Python version to use'
required: false
type: string
workflow_dispatch:
inputs:
node_version:
default: '22'
description: 'Node version to use'
required: true
type: string
python_version:
default: '3.12'
description: 'Python version to use'
required: true
type: string
permissions: {}
jobs:
build-package:
runs-on: ubuntu-24.04
steps:
- name: Checkout ixbrl-viewer
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/[email protected]
with:
cache: 'npm'
check-latest: true
node-version: ${{ inputs.node_version }}
- name: Install npm dependencies
run: npm ci
- name: Build ixbrlviewer.js
run: make prod
- name: Install Python
uses: actions/[email protected]
with:
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
check-latest: true
python-version: ${{ inputs.python_version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install build
- name: Build Python package
run: python -m build
- name: Upload source distribution artifact
uses: actions/[email protected]
with:
name: source distribution
if-no-files-found: error
path: dist/*.tar.gz
- name: Upload wheel artifact
uses: actions/[email protected]
with:
name: wheel
if-no-files-found: error
path: dist/*.whl
publish-package:
needs: build-package
environment: release
permissions:
contents: write
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Install twine
run: pip install -U twine
- name: Download source distribution artifact
uses: actions/[email protected]
with:
name: source distribution
- name: Download wheel artifact
uses: actions/[email protected]
with:
name: wheel
- name: Publish package on release
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_REPOSITORY: ${{ github.repository == 'Arelle/ixbrl-viewer' && 'pypi' || 'testpypi' }}
run: twine upload ./*
- name: Upload release artifacts
uses: softprops/[email protected]
with:
fail_on_unmatched_files: true
files: './*'