Skip to content

Commit

Permalink
Update release workflow to use separate tokens per package
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsmith committed Oct 18, 2022
1 parent 0d3c0f2 commit b130961
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
- flake8
# - towncrier-check
- docs
- package
steps:
- uses: actions/checkout@v1
- uses: actions/[email protected]
Expand All @@ -35,15 +34,29 @@ jobs:
python -m pip install --upgrade setuptools
python -m pip install tox
- run: tox -e ${{ matrix.task }}
- if: matrix.task == 'package'
uses: actions/upload-artifact@v3

package:
needs: beefore
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/[email protected]
with:
python-version: ${{ env.min_python_version }}
- run: pip install tox
- run: tox -e package
- name: Collect packages
run: |
mkdir packages
mv {.,demo,src/*}/dist/* packages
- uses: actions/upload-artifact@v3
with:
name: packages
path: "**/dist"
path: packages
if-no-files-found: error

core:
needs: beefore
needs: package
strategy:
matrix:
platform: ['macos', 'ubuntu', 'windows']
Expand All @@ -64,9 +77,10 @@ jobs:
uses: actions/download-artifact@v3
with:
name: packages
path: packages
- name: Test
env:
TOGA_INSTALL_COMMAND: 'bash -c "pip install src/{core,dummy}/dist/*.whl"'
TOGA_INSTALL_COMMAND: 'bash -c "pip install packages/toga_{core,dummy}*.whl"'
run: |
tox -e py
- if: matrix.platform == 'ubuntu' && matrix.python-version == env.min_python_version
Expand All @@ -78,7 +92,7 @@ jobs:
fail_ci_if_error: true

backend:
needs: beefore
needs: package
strategy:
matrix:
backend: [android, cocoa, gtk, iOS, web, winforms]
Expand Down Expand Up @@ -112,13 +126,14 @@ jobs:
uses: actions/download-artifact@v3
with:
name: packages
path: packages
- name: Install dependencies
run: |
${{ matrix.pre-command }}
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install pytest-tldr
python -m pip install src/{core,dummy,${{ matrix.backend }}}/dist/*.whl
python -m pip install packages/toga_{core,dummy,${{ matrix.backend }}}*.whl
- name: Test
run: |
cd src/${{ matrix.backend }}
Expand Down
26 changes: 22 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
jobs:
ci:
uses: ./.github/workflows/ci.yml

release:
name: Create Release
needs: ci
Expand All @@ -22,17 +23,34 @@ jobs:
uses: actions/download-artifact@v3
with:
name: packages
- name: Collect packages
run: mv {demo,src/*}/dist/* dist
path: packages
- name: Create Release
uses: ncipollo/[email protected]
with:
name: ${{ env.VERSION }}
draft: true
artifacts: "dist/*"
artifacts: "packages/*"
artifactErrorsFailBuild: true

deploy-test:
needs: release
strategy:
matrix:
package: ["toga", "toga_android", "toga_cocoa", "toga_core", "toga_demo",
"toga_dummy", "toga_gtk", "toga_iOS", "toga_web", "toga_winforms"]
runs-on: ubuntu-latest
steps:
- name: Get packages
uses: actions/download-artifact@v3
with:
name: packages
path: packages
- name: Extract ${{ matrix.package }}
run: |
mkdir dist
mv packages/$(echo ${{ matrix.package }} | sed 's/_/?/')* dist
- name: Publish release to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_PASSWORD }}
password: ${{ secrets[format('TEST_PYPI_PASSWORD_{0}', matrix.package)] }}

0 comments on commit b130961

Please sign in to comment.