-
-
Notifications
You must be signed in to change notification settings - Fork 11
98 lines (81 loc) · 2.73 KB
/
release.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
name: Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo repo-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
) >> $GITHUB_OUTPUT
- name: Translate Repo Name For Build Tools package_prefix
id: pkg-name
run: |
echo pkg-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }'
) >> $GITHUB_OUTPUT
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Checkout Current Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout tools repo
uses: actions/checkout@v4
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install deps
run: |
source actions-ci/install.sh
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --package_folder_prefix ${{ steps.pkg-name.outputs.pkg-name }} --library_location .
- name: Archive bundles
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: bundles
path: ${{ github.workspace }}/bundles/
- name: Upload Release Assets
if: github.event_name == 'release'
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "bundles/*"
upload-pypi:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build distributions
run: python -m build
- name: Check distributions
run: twine check dist/*
- name: Publish package (to TestPyPI)
if: github.event_name == 'workflow_dispatch' && github.repository == 'nRF24/CircuitPython_nRF24L01'
uses: pypa/[email protected]
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish package (to PyPI)
if: github.event_name != 'workflow_dispatch' && github.repository == 'nRF24/CircuitPython_nRF24L01'
uses: pypa/[email protected]