Skip to content

Change to root of exercise regardless of requires_repo #31

Change to root of exercise regardless of requires_repo

Change to root of exercise regardless of requires_repo #31

Workflow file for this run

name: Build and release Git-Mastery CLI for MacOS
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
build-and-release:
permissions:
contents: write
pull-requests: write
packages: read
issues: read
runs-on: macos-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build binary
run: |
pyinstaller --onefile --name gitmastery main.py
- name: Generate SHA256
id: checksum
run: |
FILENAME=gitmastery
SHA256=$(shasum -a 256 dist/$FILENAME | cut -d ' ' -f1)
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/gitmastery
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Homebrew Tap
env:
GH_TOKEN: ${{ secrets.ORG_PAT }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git clone https://x-access-token:${GH_TOKEN}@github.com/git-mastery/homebrew-gitmastery.git
cd homebrew-gitmastery
ls
cat <<EOF > gitmastery.rb
class Gitmastery < Formula
desc "CLI tool for Git-Mastery"
homepage "https://github.com/git-mastery/cli"
url "https://github.com/git-mastery/cli/releases/download/${GITHUB_REF_NAME}/gitmastery"
sha256 "${{ steps.checksum.outputs.sha256 }}"
version "${GITHUB_REF_NAME#v}"
def install
chmod 0755, "gitmastery"
bin.install "gitmastery"
end
test do
system "#{bin}/gitmastery", "--help"
end
end
EOF
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/git-mastery/homebrew-gitmastery.git
git remote -v
git add gitmastery.rb
git commit -m "Update to ${GITHUB_REF_NAME}"
git push origin main