Skip to content

1.0.10

1.0.10 #11

Workflow file for this run

name: Update Homebrew formula
on:
release:
types: [published]
jobs:
update-formula:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.2'
- name: Install brew
run: |
sudo apt-get update
sudo apt-get install build-essential
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >>~/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
- name: Update formula
run: |
FORMULA_PATH=Formula/moodle-to-vikwikiquiz.rb
FORMULA_NAME=moodle-to-vikwikiquiz
TAG_NAME=${GITHUB_REF/refs\/tags\//}
TAR_URL=https://github.com/gy-mate/homebrew-moodle-to-vikwikiquiz/archive/refs/tags/$TAG_NAME.tar.gz
SHA256=$(curl -L $TAR_URL | sha256sum | cut -d' ' -f1)
sed -i "s|url \".*\"|url \"$TAR_URL\"|" $FORMULA_PATH
sed -i "s|sha256 \".*\"|sha256 \"$SHA256\"|" $FORMULA_PATH
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add $FORMULA_PATH
git commit -m "Updated formula for release ${{ github.event.release.tag_name }}"
git push
- name: Test formula
run: |
brew install --build-from-source Formula/moodle-to-vikwikiquiz.rb
moodle-to-vikwikiquiz --version