Build, Sign and Upload MiddleClick #7
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: Build and Sign MiddleClick | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Decode and Import Certificate | |
env: | |
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} | |
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} | |
run: | | |
echo "$MACOS_CERTIFICATE" | base64 --decode > apple-cert.p12 | |
security import apple-cert.p12 -k ~/Library/Keychains/login.keychain-db -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign | |
rm apple-cert.p12 | |
- name: Use Latest Available Xcode | |
run: sudo xcode-select -s "$(ls -d /Applications/Xcode*.app | sort -V | tail -n 1)/Contents/Developer" | |
# use /Applications/Xcode_16.2.app instead if problems occur | |
- name: Unlock Keychain | |
run: security unlock-keychain -p "" ~/Library/Keychains/login.keychain-db | |
- name: Build MiddleClick (Using Makefile) | |
run: make all | |
env: | |
OTHER_CODE_SIGN_FLAGS: "--timestamp=none" # a workaround to disable network-based checks | |
- name: Remove Certificate | |
if: always() | |
run: security delete-certificate -c "Apple Development" | |
- name: Configure GH CLI | |
run: | | |
gh repo set-default artginzburg/MiddleClick-Sonoma | |
- name: Locate latest draft release | |
id: get_release | |
run: | | |
LATEST_DRAFT=$(gh release list --limit 1 --json tagName,isDraft -q '.[] | select(.isDraft) | .tagName') | |
echo "RELEASE_TAG=$LATEST_DRAFT" >> "$GITHUB_ENV" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Remove old asset (if exists) | |
run: | | |
ASSET_NAME="MiddleClick.zip" | |
RELEASE_ID=$(gh release view "$RELEASE_TAG" --json id -q '.id') | |
ASSET_ID=$(gh api repos/{owner}/{repo}/releases/$RELEASE_ID/assets --jq '.[] | select(.name=="'"$ASSET_NAME"'") | .id') | |
if [ -n "$ASSET_ID" ]; then | |
gh api --method DELETE repos/{owner}/{repo}/releases/assets/$ASSET_ID | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload new asset | |
run: | | |
gh release upload "$RELEASE_TAG" MiddleClick.zip --clobber | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |