Skip to content

Instantly share code, notes, and snippets.

@aslak01
Created August 15, 2023 18:30
Show Gist options
  • Save aslak01/9dbb072ee20d917d530c808478394533 to your computer and use it in GitHub Desktop.
Save aslak01/9dbb072ee20d917d530c808478394533 to your computer and use it in GitHub Desktop.
private tap github actions publish on tag
name: build
on:
push:
branches: master
jobs:
tap:
runs-on: macos-latest
steps:
- uses: Homebrew/actions/setup-homebrew@master
- run: brew tap [tap repo: githubuser/repo-WITHOUT-homebrew-prefix]
install:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: Homebrew/actions/setup-homebrew@master
- run: brew install --formula $(pwd)/Formula/*.rb
audit:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: Homebrew/actions/setup-homebrew@master
- run: brew audit --tap [tap repo: githubuser/repo-WITHOUT-homebrew-prefix]
# Creates a dummy commit when the workflow is stale to keep it from being disabled
- uses: gautamkrishnar/keepalive-workflow@master
with:
committer_username: [githubuser]
committer_email: [githubuser]@users.noreply.github.com
name: Makefile CI
on:
push:
tags:
- '*'
jobs:
making:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Setup deno
uses: denoland/setup-deno@main
with:
deno-version: v1.35.x
- name: Make and tar binary
id: compile_step
run: |
deno compile --allow-read --allow-net --allow-env --allow-run --target aarch64-apple-darwin index.ts -o [Pack Name]
tar -czvf [Pack Name].tar.gz [Pack Name]
checksum=$(sha256sum [Pack Name].tar.gz | cut -d' ' -f1)
echo "checksum was" ${checksum}
echo "CHSUM=${checksum}" >> "$GITHUB_ENV"
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
[Pack Name]
[Pack Name].tar.gz
- name: Clone Homebrew Repo
uses: actions/checkout@v3
with:
repository: [tap repo: githubuser/repo-WITH-homebrew-prefix]
token: ${{ secrets.TAP_GITHUB_TOKEN }}
ref: master
path: ./brew-stuff
- name: Update Homebrew Formula
run: |
echo "compiled checksum": $CHSUM
echo "github checksum": ${{ github.checksum }}
echo "class [Pack Name] < Formula" >> [Pack Name].rb
echo ' desc "Described"' >> [Pack Name].rb
echo ' homepage "https://github.com/GHUSER/repo"' >> pg.rb
echo ' url "https://github.com/GHUSER/repo/releases/download/'${GITHUB_REF#refs/tags/}'/[Pack Name].tar.gz"' >> [Pack Name].rb
echo ' sha256 "'"$CHSUM"'"' >> [Pack Name].rb
echo ' license "MIT"' >> [Pack Name].rb
echo "" >> [Pack Name].rb
echo " def install" >> [Pack Name].rb
echo ' bin.install "[Pack Name]"' >> [Pack Name].rb
echo " end" >> [Pack Name].rb
echo "end" >> [Pack Name].rb
cp [Pack Name].rb ./brew-stuff/Formula/
- name: Push Brew formula
run: |
cd ./brew-stuff
git add .
git config user.name github-actions
git config user.email github-actions@github.com
git commit -am "formula update ${GITHUB_REF#refs/tags/}"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment