create release workflow for windows and macos #33
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
name: Pre-release TypedUnits | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
create_version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Create version | |
run: | | |
mkdir version | |
echo "$(python _version.py).dev$(date '+%Y%m%d%H%M%S')" > version/version.txt | |
cat version/version.txt | |
- uses: actions/upload-artifact@master | |
with: | |
name: version-file | |
path: version | |
deploy: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'windows-latest', 'macos-latest'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build cibuildwheel | |
- uses: actions/download-artifact@master | |
with: | |
name: version-file | |
path: version | |
- name: Build package | |
run: | | |
export TypedUnits_RELEASE_VERSION="$(cat version/version.txt)" | |
python -m cibuildwheel --output-dir wheelhouse | |
- name: Remove Tar file | |
run: | | |
ls wheelhouse/ | |
rm wheelhouse/*.tar.gz | |
- name: Publish package to testpypi | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
repository_url: https://test.pypi.org/legacy/ | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
packages_dir: wheelhouse/ | |
# - name: Publish package to pypi | |
# uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
# with: | |
# user: __token__ | |
# password: ${{ secrets.PYPI_API_TOKEN }} | |
# packages_dir: wheelhouse/ |