Skip to content

Workflow file for this run

name: Update Homebrew Formula
on:
release:
types: [ published ]
jobs:
update-formula:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12.3
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install homebrew-pypi-poet
- name: Checkout CLI Tool Repository
run: |
git clone https://github.com/gy-mate/moodle-to-vikwikiquiz
cd moodle-to-vikwikiquiz
pip install .
- name: Generate Homebrew Formula
run: |
poet -f moodle-to-vikwikiquiz > Formula/moodle_to_vikwikiquiz.rb
- name: Update Formula
run: |
sed -i 's|https://files.pythonhosted.org/packages/source/|https://github.com/gy-mate/homebrew-moodle-to-vikwikiquiz/archive/|' Formula/moodle_to_vikwikiquiz.rb
sed -i 's|sha256 ".*"|sha256 "$(curl -sL https://github.com/gy-mate/homebrew-moodle-to-vikwikiquiz/archive/v${GITHUB_REF#refs/tags/}.tar.gz | shasum -a 256 | awk "{print \$1}")"|' Formula/moodle_to_vikwikiquiz.rb
- name: Commit and Push
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Formula/moodle_to_vikwikiquiz.rb
git commit -m "Update formula for version ${{ github.event.release.tag_name }}"
git push