@@ -3,55 +3,70 @@ name: Publish To PyPI
33on :
44 push :
55 tags :
6- - ' v*'
7-
6+ - ' v*' # runs only when you push tags like v1.2.3
7+
88jobs :
99 build-publish :
1010 runs-on : ubuntu-latest
1111
1212 steps :
13- - uses : actions/checkout@v2
14-
15- - name : Set environnment package version from tag
16- run : echo "PACKAGE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV # extract "1.2.3" from refs/tags/v1.2.3
17-
18- - name : Install Python
19- uses : actions/setup-python@v1
20- with :
21- python-version : ' 3.x'
22-
23- - name : Install node
24- uses : actions/setup-node@v4
25- with :
26- node-version : ' 20.x'
27-
28- - name : Set up JDK 11
29- uses : actions/setup-java@v4
13+ # 1 – Check out the repo
14+ - uses : actions/checkout@v2
15+
16+ # 2 – Expose the tag (e.g. 1.2.3) as $PACKAGE_VERSION
17+ - name : Set environment package version from tag
18+ run : echo "PACKAGE_VERSION=${GITHUB_REF#refs/*/v}" >> "$GITHUB_ENV"
19+
20+ # 3 – Set up Python
21+ - uses : actions/setup-python@v4
22+ with :
23+ python-version : ' 3.x'
24+
25+ # 4 – Set up Node.js
26+ - uses : actions/setup-node@v4
27+ with :
28+ node-version : ' 20.x'
29+
30+ # 5 – Set up JDK 11 (adopt) and enable sbt cache
31+ - name : Set up JDK 11
32+ uses : actions/setup-java@v4
3033 with :
3134 distribution : ' adopt'
32- java-version : 11
33- cache : sbt
34- - uses : sbt/setup-sbt@v1
35- with :
36- sbt-runner-version : 1.9.9
37-
38- - name : Install dependencies
39- run : pip install build twine
40-
41- - name : Build wheel
42- run : python -m build
43-
44- - name : Publish distribution to PyPI
45- env :
46- TWINE_USERNAME : __token__
47- TWINE_PASSWORD : ${{ secrets.PYPI_TOKEN }}
48- run : twine upload --repository pypi dist/*
49-
50- - name : Invoke workflow in systemuser-image
51- uses : benc-uk/workflow-dispatch@v1
52- with :
53- workflow : SWAN CI/CD pipeline
54- ref : master
55- repo : swan-cern/systemuser-image
56- token : ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
57- inputs : ' { "package": "sparkmonitor", "version": "${{env.PACKAGE_VERSION}}" }'
35+ java-version : ' 11'
36+ cache : ' sbt'
37+
38+ # 6 – Install the sbt launcher
39+ - name : Set up sbt
40+ uses : sbt/setup-sbt@v1
41+ with :
42+ sbt-runner-version : ' 1.9.9'
43+
44+ # 7 – Install Python build & upload deps
45+ - name : Install Python dependencies
46+ run : pip install build twine
47+
48+ # 8 – Build the wheel/sdist
49+ - name : Build distribution
50+ run : python -m build
51+
52+ # 9 – Upload to PyPI
53+ - name : Publish distribution to PyPI
54+ env :
55+ TWINE_USERNAME : __token__
56+ TWINE_PASSWORD : ${{ secrets.PYPI_TOKEN }}
57+ run : twine upload --repository pypi dist/*
58+
59+ # 10 – Trigger downstream workflow
60+ - name : Invoke workflow in systemuser-image
61+ uses : benc-uk/workflow-dispatch@v1
62+ with :
63+ workflow : SWAN CI/CD pipeline
64+ ref : master
65+ repo : swan-cern/systemuser-image
66+ token : ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
67+ inputs : |
68+ {
69+ "package": "sparkmonitor",
70+ "version": "${{ env.PACKAGE_VERSION }}"
71+ }
72+
0 commit comments