-
-
Notifications
You must be signed in to change notification settings - Fork 11
144 lines (125 loc) · 4.34 KB
/
release.yml
File metadata and controls
144 lines (125 loc) · 4.34 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Release
on:
push:
tags: ['v*']
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
permissions: {}
jobs:
build-pypi-distributions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-python@v6
id: python-setup
with:
python-version: "3.x"
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
python-version: ${{ steps.python-setup.outputs.python-version }}
enable-cache: false # prevent cache poisoning
- name: Build PyPI distributions
run: uvx --from build pyproject-build
- name: Check distributions
# this is done automatically when deploying to PyPI.
# We only do this here for non-release builds.
if: ${{ !startsWith(github.ref, 'refs/tags/v') && github.event_name != 'workflow_dispatch' }}
run: uvx twine check dist/*
- name: Archive distributions
uses: actions/upload-artifact@v7
with:
name: dist
path: ./dist/*
build-circuit-py-bundles:
runs-on: ubuntu-latest
steps:
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
env:
REPO_NAME: ${{ github.event.repository.name }}
run: |
echo repo-name=$(echo "${REPO_NAME}" |
awk '{ print tolower($1) }' |
tr '_' '-') >> $GITHUB_OUTPUT
- name: Translate Repo Name For Build Tools package_prefix
id: pkg-name
env:
REPO_NAME: ${{ github.event.repository.name }}
run: >-
echo pkg-name=$(echo "${REPO_NAME}" |
awk '{ print tolower($1) }') >> "${GITHUB_OUTPUT}"
- name: Checkout Current Repo
uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-python@v6
id: python-setup
with:
python-version: "3.x"
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
python-version: ${{ steps.python-setup.outputs.python-version }}
enable-cache: false # prevent cache poisoning
- name: Install CircuitPython Linux deps
run: |-
sudo apt-get update
sudo apt-get install libudev-dev libusb-1.0
sudo apt-get install -y gettext
- name: Build assets
env:
FILENAME_PREFIX: ${{ steps.repo-name.outputs.repo-name }}
PACKAGE_FOLDER_PREFIX: ${{ steps.pkg-name.outputs.pkg-name }}
run: >-
uvx --from circuitpython-build-tools
circuitpython-build-bundles
--filename_prefix "${FILENAME_PREFIX}"
--package_folder_prefix "${PACKAGE_FOLDER_NAME}"
--library_location .
- name: Archive bundles
uses: actions/upload-artifact@v7
with:
name: bundles
path: ${{ github.workspace }}/bundles/
upload-release-assets:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
# needed to upload release assets
contents: write
needs: [build-circuit-py-bundles]
steps:
- name: Download bundles
uses: actions/download-artifact@v8
with:
name: bundles
path: bundles
- name: Upload Release Assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |-
assets=$(ls bundles/*.zip bundles/*.json)
gh release upload "${TAG}" ${assets}
upload-pypi:
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [build-pypi-distributions]
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@v8
with:
name: dist
path: dist
- name: Publish package (to ${{ !startsWith(github.ref, 'refs/tags/v') && 'Test' || '' }}PyPI)
if: github.repository == 'nRF24/CircuitPython_nRF24L01'
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
repository-url: https://${{ startsWith(github.ref, 'refs/tags/v') && 'upload' || 'test' }}.pypi.org/legacy/