Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 36 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,52 @@ on:
branches:
- main

env:
MAIN_PYTHON_VERSION: '3.9'
PACKAGE_NAME: 'ansys-api-acp'

jobs:
build:
name: Build package
build-library:
name: "Build package"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- 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.acp.v0; print('Sucessfully imported ansys.api.acp.v0')"
python -c "from ansys.api.acp import __version__; print(__version__)"
- name: Upload packages
uses: actions/upload-artifact@v2
- name: "Build library source and wheel artifacts"
uses: ansys/actions/build-library@v4
with:
name: ansys-api-acp-packages
path: dist/
retention-days: 7
library-name: ${{ env.PACKAGE_NAME }}

Release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build]
check-version:
name: "Check version is bumped"
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.10
- name: "Check out repository"
uses: actions/checkout@v2
- name: "Check version is changed"
run: |
git fetch origin $BASE_BRANCH

- uses: actions/download-artifact@v2
VERSION_FILE=$(find src/ -name VERSION)

- name: Display structure of downloaded files
run: ls -R
NUM_CHARS=$(git diff --ignore-all-space origin/$BASE_BRANCH -- $VERSION_FILE | wc -c)

# uncomment the following section to permit upload to public PyPI
if [ $NUM_CHARS -eq 0 ]; then
echo "Version is not bumped. Please update the version in $VERSION_FILE"
exit 1
fi
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}

# - name: Upload to Public PyPi
# run: |
# pip install twine
# twine upload --skip-existing ./**/*.whl
# twine upload --skip-existing ./**/*.tar.gz
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

- name: Release
uses: softprops/action-gh-release@v1
release-pypi-private:
name: "Release to private PyPI"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && github.ref_type == 'branch' && github.ref == 'refs/heads/main'
steps:
- name: "Release to the private PyPI repository"
uses: ansys/actions/release-pypi-private@v4
with:
generate_release_notes: true
files: |
./**/*.whl
./**/*.tar.gz
./**/*.pdf
library-name: ${{ env.PACKAGE_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
2 changes: 1 addition & 1 deletion src/ansys/api/acp/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0.dev0
0.1.0.dev1