chore: pre-commit autoupdate #235
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: Build and Publish to PyPI | |
on: | |
push: | |
release: | |
types: [published] | |
permissions: | |
contents: write # Needed to upload artifacts to the release | |
id-token: write # Needed for OIDC PyPI publishing | |
jobs: | |
build: | |
name: Build artifacts | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.baipp.outputs.package_version }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4.2.2 | |
- name: Install Poetry | |
env: | |
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/constraints.txt | |
run: | | |
pipx install poetry | |
poetry --version | |
- name: Set up Python | |
uses: actions/setup-python@v5.4.0 | |
with: | |
python-version: 3.x | |
cache: 'poetry' | |
- name: Check version | |
if: github.event_name == 'release' && github.event.action == 'published' | |
run: | | |
version=$(poetry version | awk '{print $2}') | |
tag=$(echo "${{ github.ref }}" | awk '{split($0,p,"/"); print p[3]}') | |
if [ "v$version" != $tag ]; then echo "Release tag ('$tag') and poetry version ('v$version') do not match!"; exit 1; fi; | |
- name: Poetry install | |
# Required to run `alembic_freeze.py` | |
run: | | |
poetry install | |
- name: Freeze DB | |
run: | | |
poetry run scripts/alembic_freeze.py | |
- name: Release Marker | |
if: github.event_name == 'release' && github.event.action == 'published' | |
# The release marker differentiates installations 'in the wild' versus internal dev builds and tests | |
run: touch src/meltano/core/tracking/.release_marker | |
- name: Build distribution | |
uses: hynek/build-and-inspect-python-package@v2 | |
id: baipp | |
pypi_release: | |
name: Publish to PyPI | |
if: github.event_name == 'release' && github.event.action == 'published' | |
needs: [build] | |
runs-on: ubuntu-latest | |
environment: | |
name: publishing | |
url: https://pypi.org/project/meltano/${{ needs.build.outputs.version }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4.2.2 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: Packages | |
path: dist | |
- name: Upload wheel to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: dist/*.whl | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@v1.12.4 |