-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (57 loc) · 1.9 KB
/
main.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
name: Upload nlohmann-json to PyPI
on:
pull_request:
workflow_dispatch:
jobs:
get-versions:
name: "Upload latest nlohmann-json version to PyPI"
runs-on: ubuntu-latest
permissions:
contents: read
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.11"
architecture: x64
- name: Install dependencies
run: pip install build
- name: Enable brew
run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
- name: Download nlohmann-json
run: brew install nlohmann-json
- name: Get latest version
id: version
run: echo "latest=$(brew list --version nlohmann-json | sed -e 's/nlohmann-json\s//')" >> $GITHUB_OUTPUT
- name: List version
run: echo "latest=${{ steps.version.outputs.latest }}"
- name: Get the nlohmann-json contents
run: cp -r /home/linuxbrew/.linuxbrew/Cellar/nlohmann-json/${{ steps.version.outputs.latest }}/include/* src/nlohmann_json/include
- name: Set PyPI Version
run: echo "${{ steps.version.outputs.latest }}" >> PYPI_VERSION
- name: Show contents
run: ls -ahl src/nlohmann_json/include
- name: Build wheel
run: python -m build --wheel --outdir wheelhouse .
- name: Test wheel
run: |
pip install wheelhouse/*
pip install pytest
pytest
- name: Keep Wheel file
uses: actions/upload-artifact@v4
with:
name: wheelhouse
path: ./wheelhouse/*.whl
- name: List assets
run: ls ./wheelhouse/ -al
- name: Upload wheels
if: github.event_name == 'workflow_dispatch'
run: |
pip install twine
echo "Publish to PyPI..."
twine upload --verbose wheelhouse/*