Merge pull request #25 from jfrog/feature/alias-list #21
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release jfvm to Homebrew | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to release (e.g. v2.0.0)' | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.24' | |
- name: Determine tag to release | |
id: tag | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
echo "Detected manual run" | |
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
else | |
echo "Detected tag push" | |
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
fi | |
- name: Build binary | |
run: | | |
mkdir -p dist | |
go build -o dist/jfvm | |
- name: Create tarball | |
run: | | |
tar -czf jfvm-${{ steps.tag.outputs.tag }}.tar.gz -C dist jfvm | |
- name: Compute SHA256 | |
id: sha | |
run: echo "sha=$(shasum -a 256 jfvm-${{ steps.tag.outputs.tag }}.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT | |
- name: Upload GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.tag.outputs.tag }} | |
files: jfvm-${{ steps.tag.outputs.tag }}.tar.gz | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate Homebrew formula | |
run: | | |
# Remove 'v' prefix from tag for version | |
VERSION="${{ steps.tag.outputs.tag }}" | |
VERSION_NO_V="${VERSION#v}" | |
cat <<EOF > jfvm.rb | |
class Jfvm < Formula | |
desc "Manage multiple versions of JFrog CLI" | |
homepage "https://github.com/${{ github.repository }}" | |
url "https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.tag }}/jfvm-${{ steps.tag.outputs.tag }}.tar.gz" | |
sha256 "${{ steps.sha.outputs.sha }}" | |
version "${VERSION_NO_V}" | |
def install | |
bin.install "jfvm" | |
end | |
test do | |
system "#{bin}/jfvm", "--help" | |
end | |
end | |
EOF | |
- name: Upload formula to artifacts | |
uses: actions/upload-artifact@v4.6.2 | |
with: | |
name: jfvm.rb | |
path: jfvm.rb |