update #12
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: Build, Test, and Publish | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
test_sddl_parser: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies (sddl_parser) | |
run: | | |
pip install poetry | |
cd sddl_parser | |
poetry install | |
- name: Run tests (sddl_parser) | |
run: | | |
cd sddl_parser | |
poetry run pytest | |
publish_sddl: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Check if current version exists on PyPI | |
env: | |
PACKAGE_NAME: sddl_parser | |
run: | | |
pip install poetry | |
PACKAGE_VERSION=$(cd $PACKAGE_NAME && poetry version -s) | |
echo "Package version: $PACKAGE_VERSION" | |
if curl --silent --fail "https://pypi.org/pypi/${PACKAGE_NAME}/${PACKAGE_VERSION}/json"; then | |
echo "EXISTS=true" >> $GITHUB_ENV | |
else | |
echo "EXISTS=false" >> $GITHUB_ENV | |
fi | |
- name: Install dependencies and publish (sddl) | |
if: env.EXISTS == 'false' | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN_SDDL }} | |
run: | | |
pip install poetry | |
cd sddl | |
poetry install | |
poetry build | |
poetry publish | |
publish_sddl_parser: | |
needs: test_sddl_parser | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Check if current version exists on PyPI | |
env: | |
PACKAGE_NAME: sddl_parser | |
run: | | |
pip install poetry | |
PACKAGE_VERSION=$(cd $PACKAGE_NAME && poetry version -s) | |
echo "Package version: $PACKAGE_VERSION" | |
if curl --silent --fail "https://pypi.org/pypi/${PACKAGE_NAME}/${PACKAGE_VERSION}/json"; then | |
echo "EXISTS=true" >> $GITHUB_ENV | |
else | |
echo "EXISTS=false" >> $GITHUB_ENV | |
fi | |
- name: Install dependencies and publish (sddl_parser) | |
if: env.EXISTS == 'false' | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN_SDDL_PARSER }} | |
run: | | |
pip install poetry | |
cd sddl_parser | |
poetry install | |
poetry build | |
poetry publish |