Skip to content

Commit 291fb3f

Browse files
Update release job, add pypi upload, github release creation (#737)
* Add pypi upload, github release creation in cd.yml * Set version to 0.8.0.dev0 * Add readme to pyproject.toml * use v1.3 of composite action * Test run of release creation/pypi pub in cd.yml * Run tests from py 3.10 in cd.yml * Fix export of output vars in cd.yml --------- Co-authored-by: PhilippPlank <32519998+PhilippPlank@users.noreply.github.com>
1 parent 911ce1d commit 291fb3f

File tree

2 files changed

+72
-10
lines changed

2 files changed

+72
-10
lines changed

.github/workflows/cd.yml

Lines changed: 70 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
lfs: true
1414

1515
- name: setup CI
16-
uses: lava-nc/ci-setup-composite-action@v1.2
16+
uses: lava-nc/ci-setup-composite-action@v1.3
1717
with:
1818
repository: 'Lava'
1919

@@ -44,14 +44,14 @@ jobs:
4444
with:
4545
name: lava
4646

47-
- name: Set up Python 3.9
47+
- name: Set up Python 3.10
4848
uses: actions/setup-python@v4
4949
with:
50-
python-version: 3.9
50+
python-version: "3.10"
5151

5252
- name: Test artifact tar.gz
5353
run: |
54-
python3.9 -m venv artifact-test
54+
python3 -m venv artifact-test
5555
source artifact-test/bin/activate
5656
artifact=$(ls | grep lava | grep tar)
5757
pip install --no-input $artifact
@@ -63,7 +63,7 @@ jobs:
6363
6464
- name: Test artifact .whl
6565
run: |
66-
python3.9 -m venv artifact-test
66+
python3 -m venv artifact-test
6767
source artifact-test/bin/activate
6868
artifact=$(ls | grep lava | grep whl)
6969
pip install --no-input $artifact
@@ -85,17 +85,17 @@ jobs:
8585
with:
8686
name: lava
8787

88-
- name: Set up Python 3.9
88+
- name: Set up Python 3.10
8989
uses: actions/setup-python@v4
9090
with:
91-
python-version: 3.9
91+
python-version: "3.10"
9292

9393
- name: Test artifact tar.gz
9494
run: |
9595
mkdir tmp
9696
cd tmp
9797
cp ../lava* .
98-
python3.9 -m venv artifact-unittest
98+
python3 -m venv artifact-unittest
9999
source artifact-unittest/bin/activate
100100
pip install -U pip
101101
pip install "nbconvert>=7.2.10,<7.3" pytest>=7.2.0 matplotlib>=3.5.1 ipykernel>=6.15.0 nbformat>=5.3.0
@@ -114,7 +114,7 @@ jobs:
114114
mkdir tmp
115115
cd tmp
116116
cp ../lava* .
117-
python3.9 -m venv artifact-unittest
117+
python3 -m venv artifact-unittest
118118
source artifact-unittest/bin/activate
119119
pip install -U pip
120120
pip install "nbconvert>=7.2.10,<7.3" pytest>=7.2.0 matplotlib>=3.5.1 ipykernel>=6.15.0 nbformat>=5.3.0
@@ -129,3 +129,64 @@ jobs:
129129
deactivate
130130
cd ../
131131
rm -rf tmp
132+
133+
upload-release-artifact:
134+
name: Upload release artifact
135+
runs-on: ubuntu-latest
136+
if: github.triggering_actor == 'mgkwill' || github.triggering_actor == 'PhilippPlank' || github.triggering_actor == 'tim-shea'
137+
permissions:
138+
contents: write
139+
needs: [build-artifacts, test-artifact-install, test-artifact-use]
140+
141+
steps:
142+
- uses: actions/checkout@v3
143+
with:
144+
lfs: true
145+
146+
- name: setup CI
147+
uses: lava-nc/ci-setup-composite-action@v1.3
148+
with:
149+
repository: 'Lava'
150+
151+
- name: Download lava artifact
152+
uses: actions/download-artifact@v3
153+
with:
154+
name: lava
155+
156+
- name: Check Version
157+
id: check-version
158+
run: |
159+
[[ "$(pipx run poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true >> $GITHUB_OUTPUT
160+
echo "release-version=$(pipx run poetry version --short)" >> $GITHUB_OUTPUT
161+
echo "release-commit=$(git log -n 1 --pretty=format:"%H")" >> $GITHUB_OUTPUT
162+
163+
- name: Print Versions
164+
run: |
165+
[[ "$(pipx run poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true
166+
echo "release-version=$(pipx run poetry version --short)"
167+
echo "release-commit=$(git log -n 1 --pretty=format:"%H")"
168+
169+
- name: Create Release
170+
uses: ncipollo/release-action@v1
171+
with:
172+
artifacts: "lava*"
173+
token: ${{ secrets.GITHUB_TOKEN }}
174+
draft: true
175+
prerelease: steps.check-version.outputs.prerelease == 'true'
176+
name: "Lava ${{ steps.check-version.outputs.release-version }}"
177+
commit: "${{ steps.check-version.outputs.release-commit }}"
178+
tag: "v${{ steps.check-version.outputs.release-version }}"
179+
discussionCategory: "Announcements"
180+
artifactErrorsFailBuild: true
181+
generateReleaseNotes: true
182+
makeLatest: true
183+
184+
- name: Publish to PyPI
185+
if: steps.check-version.outputs.prerelease != 'true'
186+
env:
187+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
188+
run: |
189+
mkdir dist
190+
cp lava* dist/.
191+
# poetry config repositories.testpypi https://test.pypi.org/legacy/
192+
poetry publish --dry-run

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ packages = [
1010
{include = "tests"}
1111
]
1212
include = ["tutorials"]
13-
version = "0.7.0"
13+
version = "0.8.0.dev0"
14+
readme = "README.md"
1415
description = "A Software Framework for Neuromorphic Computing"
1516
homepage = "https://lava-nc.org/"
1617
repository = "https://github.com/lava-nc/lava"

0 commit comments

Comments
 (0)