janw/podcast-archiver

View on GitHub
.github/workflows/publish.yaml

Summary

Maintainability
Test Coverage
name: Publish

on:
  push:
    tags:
      - "v*.*.*"
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Check out
        uses: actions/checkout@v4

      - name: Install poetry
        run: pipx install poetry

      - name: Build package
        run: poetry build -vvv

      - uses: actions/upload-artifact@v4
        with:
          name: package
          path: |
            README.md
            pyproject.toml
            dist/*
          if-no-files-found: error
        if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

  pypi:
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
    runs-on: ubuntu-latest
    environment: release
    permissions:
      id-token: write
    needs: build
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: package

      - run: ls dist/*

      - name: Publish package distributions to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1 # cspell: disable-line

  homebrew:
    uses: janw/workflows/.github/workflows/poetry-homebrew-formula.yaml@main
    needs: pypi
    with:
      formula-name: podcast-archiver
    secrets:
      personal-access-token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
      gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
      gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}