Skip to content

Commit

Permalink
Merge pull request #8 from adamtheturtle/homebrew
Browse files Browse the repository at this point in the history
Add Homebrew to release outputs
  • Loading branch information
adamtheturtle authored Sep 11, 2024
2 parents 09382c5 + 3353100 commit 1673ec9
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,48 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true

# We have a race condition.
# In particular, we push to PyPI and then immediately try to install
# the pushed version.
# Here, we give PyPI time to propagate the package.
- name: Install doccmd from PyPI
uses: nick-fields/retry@v3
env:
NEXT_VERSION: ${{ steps.calver.outputs.release }}
with:
timeout_seconds: 10
max_attempts: 20
command: pip install doccmd==${{ env.NEXT_VERSION }}

- name: Create a Homebrew recipe
id: homebrew-create
env:
FILENAME: doccmd.rb
run: |
poet --formula doccmd > ${{ env.FILENAME }}
echo "HOMEBREW_RECIPE_FILE=${{ env.FILENAME }}" >> "$GITHUB_OUTPUT"
- name: "Update Homebrew description"
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "desc \"Shiny new formula\""
replace: "desc \"CLI for Vuforia Web Services\""
include: ${{ steps.homebrew-create.outputs.HOMEBREW_RECIPE_FILE }}
regex: false

- name: Push Homebrew Recipe
uses: dmnemec/copy_file_to_another_repo_action@main
env:
# See https://github.com/marketplace/actions/github-action-to-push-subdirectories-to-another-repo#usage
# for how to get this token.
# I do not yet know how to set this up to work with a
# "Fine-grained personal access token", only a "Token (classic)" with "repo" settings.
API_TOKEN_GITHUB: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
with:
destination_branch: master
source_file: ${{ steps.homebrew-create.outputs.HOMEBREW_RECIPE_FILE }}
destination_repo: 'VWS-Python/homebrew-vws'
user_email: '[email protected]'
user_name: 'adamtheturtle'
commit_message: 'Bump CLI Homebrew recipe'
13 changes: 13 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ Requires Python 3.11+.
pip install doccmd
With Homebrew (macOS, Linux, WSL)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Requires `Homebrew`_.

.. code:: sh
brew tap adamtheturtle/doccmd
brew install doccmd
.. _Homebrew: https://docs.brew.sh/Installation

Usage example
-------------

Expand All @@ -38,6 +50,7 @@ TODO:
* Release Homebrew
* Release pre-commit hook
* Verbose mode... "Running command "X" against README.rst example from line ..."
* Allow multiple languages (e.g. shellcheck versus shell, sh, bash)
.. |Build Status| image:: https://github.com/adamtheturtle/doccmd/actions/workflows/ci.yml/badge.svg?branch=main
:target: https://github.com/adamtheturtle/doccmd/actions
Expand Down
5 changes: 0 additions & 5 deletions admin/create_pyinstaller_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import sys
from pathlib import Path

from beartype import beartype


@beartype
def remove_existing_files(scripts: set[Path]) -> None:
"""Remove files created when building binaries.
Expand All @@ -30,7 +27,6 @@ def remove_existing_files(scripts: set[Path]) -> None:
path.unlink()


@beartype
def create_binary(script: Path) -> None:
"""Use PyInstaller to create a binary from a script.
Expand All @@ -48,7 +44,6 @@ def create_binary(script: Path) -> None:
subprocess.check_output(args=pyinstaller_command)


@beartype
def create_binaries() -> None:
"""Make PyInstaller binaries for the platform that this is being run on.
Expand Down
3 changes: 0 additions & 3 deletions admin/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

from pathlib import Path

from beartype import beartype

from admin.binaries import make_linux_binaries


@beartype
def main() -> None:
"""Perform a release."""
make_linux_binaries(repo_root=Path())
Expand Down

0 comments on commit 1673ec9

Please sign in to comment.