Skip to content

Commit 19dd313

Browse files
Merge pull request #72 from alliander-opensource/feature/automatic-release
Enable automatic release
2 parents 0d84eb7 + b817760 commit 19dd313

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ jobs:
5454
& "$env:CONDA\condabin\conda" init
5555
5656
- name: Install conda environment
57+
# TODO removed pinned v2 of catch2, see https://github.com/alliander-opensource/power-grid-model/issues/73
5758
run: |
58-
conda create --yes -p C:\conda_envs\cpp_pkgs -c conda-forge boost-cpp eigen nlohmann_json mkl mkl-devel mkl-include catch2
59+
conda create --yes -p C:\conda_envs\cpp_pkgs -c conda-forge boost-cpp eigen nlohmann_json mkl mkl-devel mkl-include catch2==2.13.9
5960
6061
- name: Build and test
6162
run: |
@@ -95,8 +96,10 @@ jobs:
9596
- uses: actions/checkout@v3
9697

9798
- name: Install cpp dependencies
99+
# TODO removed pinned v2 of catch2, see https://github.com/alliander-opensource/power-grid-model/issues/73
98100
run: |
99-
brew install ninja boost eigen nlohmann-json catch2
101+
brew install ninja boost eigen nlohmann-json
102+
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/5e5abb11bf49787d01164c4066119365262c21ed/Formula/catch2.rb > $(find $(brew --repository) -name catch2.rb) && brew reinstall catch2
100103
sudo pip3 install mkl mkl-devel mkl-include
101104
102105
- name: Build and test
@@ -197,6 +200,8 @@ jobs:
197200
publish-wheels:
198201
needs: build-and-test-python
199202
runs-on: ubuntu-latest
203+
permissions:
204+
contents: write
200205
env:
201206
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
202207
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
@@ -215,12 +220,30 @@ jobs:
215220
name: wheelhouse
216221
path: wheelhouse
217222

218-
- name: List wheels
219-
run: ls ./wheelhouse/*.whl -al
223+
- name: List assets
224+
run: |
225+
ls ./wheelhouse/*.whl -al
226+
227+
- name: Get tag
228+
id: tag
229+
run: echo "::set-output name=tag::v$(ls ./wheelhouse/*cp310*manylinux2014_x86_64*.whl | awk -F'[-]' '{print $2}')"
230+
231+
- name: Display tag
232+
run: echo "${{ steps.tag.outputs.tag }}"
220233

221234
- name: Upload wheels
222235
if: (github.event_name == 'push') || (github.event_name == 'workflow_dispatch')
223236
run: |
224237
pip install twine
225238
echo "Publish to PyPI..."
226239
twine upload --verbose wheelhouse/*
240+
241+
- name: Release
242+
uses: softprops/action-gh-release@v1
243+
if: (github.event_name == 'push') || (github.event_name == 'workflow_dispatch')
244+
with:
245+
files: |
246+
./wheelhouse/*.whl
247+
tag_name: ${{ steps.tag.outputs.tag }}
248+
prerelease: ${{ contains(steps.tag.outputs.tag, 'rc') }}
249+
generate_release_notes: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,3 +503,6 @@ cpp_coverage.info
503503
python_cov_html/
504504
python_coverage.xml
505505
cpp_coverage.xml
506+
507+
# generated version file
508+
PYPI_VERSION

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ def get_version(pkg_dir: Path) -> str:
214214
version += f"rc9{build_number}{short_hash}"
215215
else:
216216
# feature branch
217-
# major.minor.patch a 0 build_number short_hash
218-
version += f"a0{build_number}{short_hash}"
217+
# major.minor.patch a 1 build_number short_hash
218+
version += f"a1{build_number}{short_hash}"
219+
with open(pkg_dir / "PYPI_VERSION", "w") as f:
220+
f.write(version)
219221
return version
220222

221223

0 commit comments

Comments
 (0)