Skip to content

Commit

Permalink
build: Publish brew formula
Browse files Browse the repository at this point in the history
  • Loading branch information
janw committed Jan 31, 2024
1 parent 1b9ce30 commit 56427de
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- "v*.*.*"
branches:
- "publish-to-brew-tap" #FIXME: REMOVE
pull_request:

jobs:
Expand Down Expand Up @@ -45,3 +47,55 @@ jobs:

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

homebrew:
if: github.event_name == 'push' # && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: release
needs: build
steps:
- uses: actions/checkout@v4
with:
repository: janw/homebrew-tap

- uses: actions/checkout@v4
with:
path: '_podcast-archiver'

- 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
fingerprint: 2B939A343491740FE1483E5C41E311388E4BB349

- name: List keys
run: gpg -K

- name: Install poetry + poetry-brew
run: |
pipx install 'poetry>=1.7.0'
pipx inject poetry poetry-homebrew-formula
- name: Update formula
shell: bash
run: |
poetry homebrew-formula -C _podcast-archiver/ \
--verbose \
--template _podcast-archiver/brew/template.rb.j2 \
--output ./Formula/podcast-archiver.rb
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
add-paths: |
Formula/*
commit-message: "bump(podcast-archiver): ${{github.ref_name}}"
title: "bump(podcast-archiver): ${{github.ref_name}}"
body: ""
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
push-to-fork: janw-bot/homebrew-tap
committer: Jan Willhaus [bot] <[email protected]>
25 changes: 25 additions & 0 deletions brew/template.rb.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class {{ formula_name }} < Formula
include Language::Python::Virtualenv

desc "{{ package.description }}"
{% if package.homepage %} homepage "{{ package.homepage }}"
{% endif %}
{% if package.license %} license "{{ package.license }}"
{% endif %}

{{ PACKAGE_URL }}

depends_on "python3"
depends_on "rust" => :build

{{ RESOURCES }}

def install
virtualenv_create(libexec, "python3")
virtualenv_install_with_resources
end

test do
false
end
end

0 comments on commit 56427de

Please sign in to comment.