Skip to content

docs: Revert to homebrew-tap and clarify tap command #13

docs: Revert to homebrew-tap and clarify tap command

docs: Revert to homebrew-tap and clarify tap command #13

Workflow file for this run

name: Create Unified Release
on:
push:
tags:
- 'v*'
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write # Needed to create the release and upload assets
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed to generate release notes from history
- name: Generate Release Notes
id: release_notes
run: |
chmod +x ./scripts/generate_release_notes.sh
NOTES=$(./scripts/generate_release_notes.sh)
# This is a GHA trick to make a multiline string available to other steps
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Build the Debian package
run: |
chmod +x ./scripts/build_packages.sh
bash ./scripts/build_packages.sh ${{ github.ref_name }}
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: ${{ steps.release_notes.outputs.notes }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
files: |
docker-ai_${{ github.ref_name }}_amd64.deb
update-homebrew-tap:
runs-on: ubuntu-latest
needs: build-and-release
permissions:
contents: write
steps:
- name: Checkout Homebrew tap repository
uses: actions/checkout@v4
with:
repository: Aj7Ay/homebrew-tap
token: ${{ secrets.PAT_FOR_HOMEBREW_TAP }}
path: homebrew-tap
- name: Calculate SHA256 of the new release tarball
id: shasum
run: |
RELEASE_URL="https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.ref_name }}.tar.gz"
SHA256=$(curl -L $RELEASE_URL | shasum -a 256 | cut -d' ' -f1)
echo "sha256=${SHA256}" >> $GITHUB_ENV
- name: Update Homebrew formula
run: |
cd homebrew-tap
sed -i "s|url \".*\"|url \"https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.ref_name }}.tar.gz\"|" docker-ai.rb
sed -i "s/sha256 \".*\"/sha256 \"${{ env.sha256 }}\"/" docker-ai.rb
- name: Commit and push changes
run: |
cd homebrew-tap
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add docker-ai.rb
if git diff --staged --quiet; then
echo "No changes to the formula to commit."
else
git commit -m "Update docker-ai to ${{ github.ref_name }}"
git push
fi