Skip to content

Add workflow to automatically publish the package in PyPi #1

Add workflow to automatically publish the package in PyPi

Add workflow to automatically publish the package in PyPi #1

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'src/**'
- 'pyproject.toml'
jobs:
release:
name: Release, Python ${{ matrix.python-version }}
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
strategy:
matrix:
python-version: '3.11'

Check failure on line 19 in .github/workflows/release.yaml

View workflow run for this annotation

GitHub Actions / Release

Invalid workflow file

The workflow is not valid. .github/workflows/release.yaml (Line: 19, Col: 25): Unexpected value '3.11'
environment:
name: PyPI
url: https://pypi.org/p/ongoing-process-state
permissions:
id-token: write
contents: write
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install poetry
shell: bash
run: pip install poetry
- name: Install project
run: |
poetry install
- name: Build
run: |
poetry build
- name: Get version
id: get_version
run: |
echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ongoing-process-state-${{ steps.get_version.outputs.version }}-py${{ matrix.python-version }}
path: dist
- name: Generate changelog
run: |
echo "# Changelog" > CHANGELOG.md
echo "" >> CHANGELOG.md
echo "\`\`\`" >> CHANGELOG.md
git log --pretty=format:"%h - %s (%an)" $(git describe --tags --abbrev=0)..HEAD >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "\`\`\`" >> CHANGELOG.md
- name: Assign repository tag
run: |
git tag ${{ steps.get_version.outputs.version }}
git push --tags
- name: Create release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*
tag_name: ${{ steps.get_version.outputs.version }}
body_path: CHANGELOG.md
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1