Promote package to production #2
This file contains hidden or 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: Promote package to production | |
| on: | |
| # Allows manual run from the Actions tab | |
| workflow_dispatch: | |
| inputs: | |
| package_version: | |
| description: 'Package version to promote' | |
| required: true | |
| jobs: | |
| promote-package-to-production: | |
| name: Promote to production | |
| runs-on: ubuntu-latest | |
| environment: Release_Production | |
| steps: | |
| - name: Set package variables | |
| run: | | |
| echo "PACKAGE_NAME=fpg_observational_model" >> $GITHUB_ENV | |
| - name: Check out repo | |
| uses: actions/checkout@v4 | |
| - name: Setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - name: Download package from staging | |
| env: | |
| PIP_EXTRA_INDEX_URL: https://${{ secrets.STAGING_ARTIFACTORY_USERNAME }}:${{ secrets.STAGING_ARTIFACTORY_PASSWORD }}@packages.idmod.org/api/pypi/idm-pypi-staging/simple/ | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip download --index-url $PIP_EXTRA_INDEX_URL --no-deps ${{ env.PACKAGE_NAME }}==${{ github.event.inputs.package_version }} -d ./dist | |
| - name: Install staging package | |
| run: | | |
| pip install ./dist/${{ env.PACKAGE_NAME }}-${{ github.event.inputs.package_version }}-py3-none-any.whl --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple | |
| - name: Run unit tests | |
| run: | | |
| pip install pytest, pytest-cov | |
| cd tests | |
| pytest | |
| - name: Install twine | |
| run: pip install twine | |
| - name: Upload to production PyPI | |
| run: | | |
| twine upload --verbose \ | |
| --repository-url https://packages.idmod.org/api/pypi/idm-pypi-production/ \ | |
| --username ${{ secrets.PROD_ARTIFACTORY_USERNAME }} \ | |
| --password ${{ secrets.PROD_ARTIFACTORY_PASSWORD }} \ | |
| ./dist/*.whl |