-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add publish workflow to pypi and testpypi.
- Loading branch information
1 parent
b44c161
commit fcbe8d4
Showing
2 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# This workflows will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Publish mikeplus Python Package | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: windows-latest | ||
|
||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Unzip MIKE+ dependency | ||
run: | | ||
7z x "2024_1.7z" -p${{ secrets.MIKE_2024_0_7Z }} | ||
- name: Install MIKE+ dependency | ||
run: | | ||
./install.ps1 2024 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
lfs: true | ||
|
||
- name: Set up .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '6.0.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pytest | ||
pip install build wheel twine | ||
- name: Install package | ||
run: pip install .[test] | ||
|
||
- name: Test package | ||
run: pytest -v -m "not license_required and not slow" | ||
|
||
- name: Build package | ||
run: python -m build | ||
|
||
- name: Archive distributions | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release-dists | ||
path: dist/ | ||
|
||
# using a trusted publisher is recommended: | ||
# https://docs.pypi.org/trusted-publishers/ | ||
# uncomment if you want to upload to PyPI | ||
# - name: Publish package distributions to PyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Use this file to test publishing mikeplus package to TestPyPI | ||
# | ||
# Same as python_publish.yml, but: | ||
# | ||
# - Manually triggered | ||
# - No publishing to PyPI, instead it published to TestPyPI | ||
# | ||
|
||
name: Test Publish mikeplus Python Package | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
# release: | ||
# types: [created] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: windows-latest | ||
|
||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Unzip MIKE+ dependency | ||
run: | | ||
7z x "2024_1.7z" -p${{ secrets.MIKE_2024_0_7Z }} | ||
- name: Install MIKE+ dependency | ||
run: | | ||
./install.ps1 2024 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
lfs: true | ||
|
||
- name: Set up .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '6.0.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pytest | ||
pip install build wheel twine | ||
- name: Install mikepluspy | ||
run: pip install .[test] | ||
|
||
- name: Test with pytest | ||
run: pytest -v -m "not license_required and not slow" | ||
|
||
- name: Build package | ||
run: python -m build | ||
|
||
- name: Archive distributions | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release-dists | ||
path: dist/ | ||
|
||
- name: Publish package distributions to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ |