feat: allow ansys-tools-protoc-helper builds (#34) #94
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: GitHub CI | |
# run only on main branch. This avoids duplicated actions on PRs | |
on: | |
pull_request: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
env: | |
MAIN_PYTHON_VERSION: '3.11' | |
jobs: | |
build: | |
name: Build package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: Run protolint | |
uses: plexsystems/protolint-action@v0.7.0 | |
with: | |
configDirectory: . | |
- name: Install build requirements | |
run: | | |
pip install -U pip | |
pip install build | |
- name: Build | |
run: python -m build | |
- name: Install | |
run: pip install dist/*.whl | |
- name: Test import | |
run: | | |
mkdir tmp | |
cd tmp | |
python -c "import ansys.api.dbu.v0; print('Successfully imported ansys.api.dbu.v0')" | |
python -c "from ansys.api.dbu import __version__; print(__version__)" | |
- name: Upload packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ansys-api-dbu-artifacts | |
path: dist/ | |
retention-days: 7 | |
release: | |
name: Release package | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
needs: [build] | |
runs-on: ubuntu-latest | |
# Specifying a GitHub environment is optional, but strongly encouraged | |
environment: release | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: Release to the public PyPI repository | |
uses: ansys/actions/release-pypi-public@v8 | |
with: | |
library-name: "ansys-api-dbu" | |
use-trusted-publisher: true | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
files: | | |
./**/*.whl | |
./**/*.tar.gz | |