Skip to content

Commit a6787f4

Browse files
committed
moved up asset upload
1 parent 286e2cc commit a6787f4

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

.github/workflows/test_and_deploy.yml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,28 @@ on:
1717
workflow_dispatch:
1818

1919
jobs:
20+
add-assets-to-release:
21+
name: Add Sample Data Asset to Release
22+
if: startsWith(github.ref, 'refs/tags/') # only run on tag pushes (releases)
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Create sample_data.zip
27+
run: |
28+
cd src/napari_clusters_plotter/sample_data
29+
zip -r ../../../sample_data.zip . -x "*.git*"
30+
- name: Upload Sample Data Asset
31+
uses: softprops/action-gh-release@v1
32+
with:
33+
files: sample_data.zip
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
2037
test:
2138
name: ${{ matrix.platform }} py${{ matrix.python-version }}
2239
runs-on: ${{ matrix.platform }}
40+
needs: [add-assets-to-release] # Wait for assets to be uploaded
41+
if: always() # Run tests even if no release assets (for PRs)
2342
strategy:
2443
matrix:
2544
platform: [ubuntu-latest, windows-latest, macos-latest] # macos-latest (disabled, see related issue)
@@ -65,6 +84,7 @@ jobs:
6584

6685
build:
6786
name: Build distribution 📦
87+
needs: [test] # Wait for tests to pass
6888
runs-on: ubuntu-latest
6989

7090
steps:
@@ -89,6 +109,7 @@ jobs:
89109
Publish Python 🐍 distribution 📦 to PyPI
90110
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
91111
needs:
112+
- test
92113
- build
93114
runs-on: ubuntu-latest
94115
environment:
@@ -105,22 +126,3 @@ jobs:
105126
path: dist/
106127
- name: Publish distribution 📦 to PyPI
107128
uses: pypa/gh-action-pypi-publish@release/v1
108-
109-
add-assets-to-release:
110-
name: Add Sample Data Asset to Release
111-
needs: [build]
112-
runs-on: ubuntu-latest
113-
steps:
114-
- uses: actions/checkout@v3
115-
- name: Create sample_data.zip
116-
run: |
117-
python src/napari_clusters_plotter/sample_data/create_sample_data_assets.py
118-
- name: Upload Sample Data Asset
119-
uses: actions/upload-release-asset@v1
120-
env:
121-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122-
with:
123-
upload_url: ${{ github.event.release.upload_url }}
124-
asset_path: ./src/napari_clusters_plotter/sample_data/sample_data.zip
125-
asset_name: sample_data.zip
126-
asset_content_type: application/zip

0 commit comments

Comments
 (0)