Update #8
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 | |
id: check_version_sddl | |
env: | |
PACKAGE_NAME: sddl | |
run: | | |
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 "Version ${PACKAGE_VERSION} already exists on PyPI. Skipping publish." | |
echo "##[endgroup]" | |
exit 78 # Exiting with this status causes the workflow to be marked as neutral, indicating no further action will be taken. | |
else | |
echo "Version ${PACKAGE_VERSION} does not exist on PyPI. Proceeding to publish." | |
fi | |
- name: Install dependencies and publish (sddl) | |
if: steps.check_version_sddl.outcome == 'success' | |
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 | |
id: check_version_sddl_parser | |
env: | |
PACKAGE_NAME: sddl_parser | |
run: | | |
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 "Version ${PACKAGE_VERSION} already exists on PyPI. Skipping publish." | |
echo "##[endgroup]" | |
exit 78 # Exiting with this status causes the workflow to be marked as neutral, indicating no further action will be taken. | |
else | |
echo "Version ${PACKAGE_VERSION} does not exist on PyPI. Proceeding to publish." | |
fi | |
- name: Install dependencies and publish (sddl_parser) | |
if: steps.check_version_sddl_parser.outcome == 'success' | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN_SDDL_PARSER }} | |
run: | | |
pip install poetry | |
cd sddl_parser | |
poetry install | |
poetry build | |
poetry publish |