Skip to content

Sign MacOS Binaries with JFrog Certificate #2

Sign MacOS Binaries with JFrog Certificate

Sign MacOS Binaries with JFrog Certificate #2

# This workflow is responsible for building and signing and uploading macOS CLI binaries.
# The CLI release job will consume the produced binaries.
name: Prepare MacOS binaries for CLI release
on: [ push ]
jobs:
# Delete old artifacts before signing new binaries
# To allow the release job to better find the signed binaries
Test:
name: test extract version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract_version.outputs.releaseVersion }}
steps:
- name: Extract version
id: extract_version
run: |
VERSION=$(echo "${{ github.event.head_commit.message }}" | awk -F'to ' '{print $2}' | sed 's/[^0-9.]*//g')
echo "releaseVersion=$VERSION" >> $GITHUB_OUTPUT
# DeleteOldArtifacts:
# name: Delete-Old-Artifacts
# runs-on: ubuntu-latest
# steps:
# - uses: kolpav/purge-artifacts-action@v1
# with:
# token: ${{ secrets.JF_GIT_TOKEN }}
# expire-in: 0 # Setting this to 0 will delete all artifacts
prepareBinary:
needs: extract_version
name: Prepare-Binary
runs-on: macos-latest
if: ${{ contains(github.event.head_commit.message, 'Bump version from') }}
strategy:
matrix:
goarch: [ arm64,amd64 ]
steps:
- env:
releaseVersion: ${{needs.extract_version.outputs.releaseVersion}}
# Setup
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache: false
- name: Set Environment Variable
run: echo "goarch=${{ matrix.goarch }}" >> $GITHUB_ENV
# Build
- name: Checkout Source
uses: actions/checkout@v4
- name: Build
run: ./build/build.sh
# Sign
- name: Sign Binary
env:
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }}
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: ./build/macOsSign/signMacOsBinary.sh
# Upload
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: jf-darwin-v${{ env.releaseVersion }}-${{ matrix.goarch }}
path: ./jf
retention-days: 1