@@ -115,11 +115,13 @@ jobs:
115115 platforms : linux/amd64,linux/arm64
116116
117117 release-pypi :
118+ name : Release, Python ${{ matrix.python-version }}
118119 needs : [ test ]
119120 runs-on : ubuntu-latest
120- outputs :
121- version : ${{ steps.versioning.outputs.version }}
122- if : github.ref == 'refs/heads/master'
121+ if : github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
122+ strategy :
123+ matrix :
124+ python-version : [ '3.9' ]
123125 environment :
124126 name : PyPI
125127 url : https://pypi.org/p/simod
@@ -128,27 +130,37 @@ jobs:
128130 contents : write
129131 packages : write
130132 steps :
131- - name : Checkout
132- uses : actions/checkout@v3
133+ - uses : actions/checkout@v3
133134 with :
134135 fetch-depth : 0
135136
137+ - uses : actions/setup-python@v3
138+ with :
139+ python-version : ${{ matrix.python-version }}
140+ architecture : x64
141+
136142 - name : Install poetry
143+ shell : bash
137144 run : pip install poetry
138145
146+ - name : Install project
147+ run : |
148+ poetry install
149+
139150 - name : Build
140- run : poetry install && poetry build
151+ run : |
152+ poetry build
141153
142- - name : Generate licenses.md
154+ - name : Get version
155+ id : get_version
143156 run : |
144- poetry run pip install pip-licenses
145- poetry run pip-licenses --with-system --with-urls --format=markdown --output-file=licenses.md
157+ echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"
146158
147- - name : Upload licenses.md
148- uses : actions/upload-artifact@v4
159+ - name : Upload artifacts
160+ uses : actions/upload-artifact@v3
149161 with :
150- name : licenses.md
151- path : licenses.md
162+ name : simod-${{ steps.get_version.outputs.version }}-py${{ matrix.python-version }}
163+ path : dist
152164
153165 - name : Generate changelog
154166 run : |
@@ -159,24 +171,18 @@ jobs:
159171 echo "" >> CHANGELOG.md
160172 echo "\`\`\`" >> CHANGELOG.md
161173
162- - name : Get the version
163- id : versioning
164- run : echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"
165-
166- - name : Assign a version tag if not present
174+ - name : Assign repository tag
167175 run : |
168- if ! git rev-parse ${{ steps.versioning.outputs.version }}; then
169- git tag ${{ steps.versioning.outputs.version }}
170- git push --tags
171- fi
176+ git tag ${{ steps.get_version.outputs.version }}
177+ git push --tags
172178
173- - name : Create a release if needed
179+ - name : Create release
174180 uses : softprops/action-gh-release@v1
175181 with :
176182 files : |
177183 dist/*
178- tag_name : ${{ steps.versioning .outputs.version }}
184+ tag_name : ${{ steps.get_version .outputs.version }}
179185 body_path : CHANGELOG.md
180186
181187 - name : Publish to PyPI
182- uses : pypa/gh-action-pypi-publish@release/v1
188+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments