Skip to content

Release

Release #249

Workflow file for this run

name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
release:
name: Create GitHub release
runs-on: ubuntu-22.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
current_version: ${{ steps.get_version.outputs.current_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get the version
id: get_version
#run: echo ::set-output name=current_version::${GITHUB_REF#refs/tags/}
run: echo "current_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create Release ${{ github.ref }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: contains(github.ref, '-')
# draft: true # we would like to publish a draft, but brew needs the release to be publis
- name: Update formula release
uses: marcprux/update-homebrew-formula-action@main
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_FAIRTOOL_PUBLISH_TOKEN }}
with:
repository: fair-ground/Fair
tap: fair-ground/homebrew-tool
name: fairtool
formula: Formula/fairtool.rb
bottle_macos:
name: Homebrew bottle (macOS)
runs-on: macos-12
needs: [release]
steps:
- name: Build bottle (x86_64)
run: |
#HOMEBREW_FAIRTOOL_ARCH="x86_64"
brew install --build-bottle --verbose fair-ground/tool/fairtool
file `which fairtool`
fairtool version
brew bottle --no-rebuild --verbose fair-ground/tool/fairtool
ls -la *.gz
brew remove fair-ground/tool/fairtool
# There's something hinky with the bottling process;
# about 1/2 the time it produces a very corrupt binary
# that will yield the error:
# exec format error: fairtool
# This step will extract the binary and make sure it
# can really be run before continuing with the
# bottling process.
- name: Verify bottle (x86_64)
run: |
TD=`mktemp -d`
cp -av fairtool--*.bottle.tar.gz "${TD}"
cd "${TD}"
tar xvzf fairtool--*.bottle.tar.gz
file ./fairtool/*/bin/fairtool
./fairtool/*/bin/fairtool version
cd -
- name: Upload bottle (x86_64)
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./fairtool--${{ needs.release.outputs.current_version }}.monterey.bottle.tar.gz
asset_name: fairtool-${{ needs.release.outputs.current_version }}.monterey.bottle.tar.gz
asset_content_type: application/gzip
- name: Build bottle (arm64)
run: |
HOMEBREW_FAIRTOOL_ARCH="arm64" brew install --build-bottle --verbose fair-ground/tool/fairtool
file `which fairtool`
# fairtool version # no reverse-rosetta
brew bottle --no-rebuild --verbose fair-ground/tool/fairtool
ls -la *.gz
brew remove fair-ground/tool/fairtool
- name: Upload bottle (arm64)
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./fairtool--${{ needs.release.outputs.current_version }}.monterey.bottle.tar.gz
asset_name: fairtool-${{ needs.release.outputs.current_version }}.arm64_monterey.bottle.tar.gz
asset_content_type: application/gzip
bottle_linux:
name: Homebrew bottle (linux)
runs-on: ubuntu-22.04
needs: [release]
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Build bottle
run: |
brew tap fair-ground/tool
brew install --build-bottle --verbose fair-ground/tool/fairtool
fairtool version
brew bottle --no-rebuild --verbose fair-ground/tool/fairtool
ls -la *.gz
brew remove fair-ground/tool/fairtool
- name: Upload bottle
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./fairtool--${{ needs.release.outputs.current_version }}.x86_64_linux.bottle.tar.gz
asset_name: fairtool-${{ needs.release.outputs.current_version }}.x86_64_linux.bottle.tar.gz
asset_content_type: application/gzip
update_bottle:
name: Add bottles to formula
runs-on: ubuntu-22.04
needs: [release, bottle_macos, bottle_linux]
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- uses: marcprux/update-homebrew-formula-action@main
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_FAIRTOOL_PUBLISH_TOKEN }}
with:
repository: fair-ground/Fair
tap: fair-ground/homebrew-tool
name: fairtool
formula: Formula/fairtool.rb
message: |
Add bottles for fairtool ${{ needs.release.outputs.current_version }}
- name: Publish release
if: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release edit "${{ needs.release.outputs.current_version }}" --draft=false
- name: Check released bottle
run: |
brew install --force-bottle fair-ground/tool/fairtool
fairtool version