build: Publish to homebrew-tap #2
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: 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 | ||
needs: build | ||
steps: | ||
- name: Install poetry | ||
run: pipx install poetry | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: package | ||
- run: ls dist/* | ||
- name: Publish package | ||
run: poetry publish | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | ||
homebrew: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
runs-on: ubuntu-latest | ||
environment: release | ||
needs: publish | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: janw/homebrew-tap | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: 'podcast-archiver' | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
id: gpg-import | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_tag_gpgsign: true | ||
fingerprint: 2B939A343491740FE1483E5C41E311388E4BB349 | ||
- name: List keys | ||
run: gpg -K | ||
- name: Install poetry + poetry-brew | ||
run: | | ||
pipx install 'poetry>=1.7.0' | ||
pipx inject poetry git+https://github.com/janw/poetry-brew.git | ||
- name: Update formula | ||
run: poetry brew -C ../podcast-archiver/ -v --output ./Formula | ||
- name: Commit and push | ||
run: | | ||
git add Formula/podcast-archiver.rb | ||
git commit -m "bump(podcast-archiver): ${{github.ref_name}}" | ||
git push |