diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 90fd3447d..6b3785f62 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -25,10 +25,20 @@ jobs: - name: Build the distribution run: python setup.py sdist bdist_wheel + - name: Publish dist to TestPyPI + if: github.repository == 'ScilifelabDataCentre/dds_cli' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + print_hash: true + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: true + - name: Publish dist to PyPI if: github.repository == 'ScilifelabDataCentre/dds_cli' uses: pypa/gh-action-pypi-publish@release/v1 with: + print_hash: true user: __token__ password: ${{ secrets.pypi_password }} skip_existing: true diff --git a/.github/workflows/test-pypi-cli.yml b/.github/workflows/test-pypi-cli.yml new file mode 100644 index 000000000..24e6a4bf9 --- /dev/null +++ b/.github/workflows/test-pypi-cli.yml @@ -0,0 +1,33 @@ +name: Publish CLI to TestPyPi +on: + pull_request: + branches: [dev] +jobs: + build-n-publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + name: Check out source-code repository + + - name: Set up Python 3.9 + uses: actions/setup-python@v1 + with: + python-version: 3.9 + + - name: Install python dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + pip install . + + - name: Build the distribution + run: python setup.py sdist bdist_wheel + + - name: Publish dist to TestPyPI + if: github.repository == 'ScilifelabDataCentre/dds_cli' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + print_hash: true + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 3185f71ca..18c194482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -226,3 +226,4 @@ Please add a _short_ line describing the PR you make, if the PR implements a spe # Sprint (2023-01-09 - 2023-01-20) - Workflow: Scan with Trivy on PR and schedule ([#591](https://github.com/ScilifelabDataCentre/dds_cli/pull/591)) +- Workflow: Publish to TestPyPi on PR and release ([#592](https://github.com/ScilifelabDataCentre/dds_cli/pull/592))