Release tagged package #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release tagged package | |
on: [workflow_dispatch] | |
jobs: | |
pylint: | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
uses: ./.github/workflows/define-pylint.yml | |
with: | |
python-version: ${{ matrix.python-version }} | |
pytest: | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
uses: ./.github/workflows/define-pytest.yml | |
with: | |
python-version: ${{ matrix.python-version }} | |
build: | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Run all tests with pytest | |
run: | | |
python -m build | |
- name: Persist builds | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-dist-${{ matrix.python-version }} | |
path: dist/* | |
tag: | |
runs-on: self-hosted | |
outputs: | |
release-tag: ${{ steps.read-tag.outputs.release-tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
pip install tomli | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Read tag from pyproject.toml | |
id: read-tag | |
shell: bash | |
run: | | |
TAG=$(python -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["project"]["version"])') | |
echo "release-tag=$(echo $TAG)" >> GITHUB_OUTPUT | |
- uses: mukunku/[email protected] | |
id: check-tag | |
with: | |
tag: ${{ steps.read-tag.outputs.release-tag }} | |
- name: Fail if tag exists | |
run: | | |
echo "Tag exists!" | |
exit 1 | |
if: steps.check-tag.outputs.exists == 'true' | |
release: | |
needs: [pylint, pytest, build, tag] | |
runs-on: self-hosted | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Load persisted builds | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: build-dist-* | |
path: dist/* | |
merge-multiple: true | |
- name: Add body.md | |
shell: bash | |
run: | | |
touch body.md | |
- name: Create new release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ needs.tag.outputs.release-tag }} | |
artifacts: "dist/*" | |
bodyFile: "body.md" |