forked from dmwm/WMCore
-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (34 loc) · 1.2 KB
/
pypi_build_publish_template.yaml
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
# Reusable workflow to setup a specific WMCore component for pip
on:
workflow_call:
inputs:
wmcore_component:
required: true
type: string
jobs:
build_and_publish_from_template:
runs-on: ubuntu-latest
environment:
name: production
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Setup python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Upgrade pip3
run: |
python3 -m pip install --upgrade pip
- name: Update the setup script template with package name
run: |
sed "s/PACKAGE_TO_BUILD/${{ inputs.wmcore_component }}/" setup_template.py > setup.py
- name: Create requirements file
run: |
cp requirements.txt requirements.wmcore.txt
awk "/(${{ inputs.wmcore_component }}$)|(${{ inputs.wmcore_component }},)/ {print \$1}" requirements.wmcore.txt > requirements.txt
- name: Build sdist
run: python3 setup.py clean sdist
- name: Upload package distribution to PyPi
uses: pypa/gh-action-pypi-publish@release/v1