Attempt to fix .bundle workflow checkout (#2566)

This commit is contained in:
Zane
2025-05-16 15:23:37 -07:00
committed by GitHub
parent a60cef233b
commit 2527e2a821
2 changed files with 135 additions and 27 deletions
+73 -24
View File
@@ -21,6 +21,11 @@ on:
required: false required: false
default: true default: true
type: boolean type: boolean
ref:
description: 'Git ref to checkout (branch, tag, or SHA). Defaults to main branch if not specified.'
required: false
type: string
default: ''
secrets: secrets:
CERTIFICATE_OSX_APPLICATION: CERTIFICATE_OSX_APPLICATION:
description: 'Certificate for macOS application signing' description: 'Certificate for macOS application signing'
@@ -45,6 +50,30 @@ jobs:
runs-on: macos-latest runs-on: macos-latest
name: Bundle Desktop App on macOS name: Bundle Desktop App on macOS
steps: steps:
# Debug information about the workflow and inputs
- name: Debug workflow info
env:
WORKFLOW_NAME: ${{ github.workflow }}
WORKFLOW_REF: ${{ github.ref }}
EVENT_NAME: ${{ github.event_name }}
REPOSITORY: ${{ github.repository }}
INPUT_REF: ${{ inputs.ref }}
INPUT_VERSION: ${{ inputs.version }}
INPUT_SIGNING: ${{ inputs.signing }}
INPUT_QUICK_TEST: ${{ inputs.quick_test }}
run: |
echo "=== Workflow Information ==="
echo "Workflow: ${WORKFLOW_NAME}"
echo "Ref: ${WORKFLOW_REF}"
echo "Event: ${EVENT_NAME}"
echo "Repo: ${REPOSITORY}"
echo ""
echo "=== Input Parameters ==="
echo "Build ref: ${INPUT_REF:-<default branch>}"
echo "Version: ${INPUT_VERSION:-not set}"
echo "Signing: ${INPUT_SIGNING:-false}"
echo "Quick test: ${INPUT_QUICK_TEST:-true}"
# Check initial disk space # Check initial disk space
- name: Check initial disk space - name: Check initial disk space
run: df -h run: df -h
@@ -52,43 +81,63 @@ jobs:
# Validate Signing Secrets if signing is enabled # Validate Signing Secrets if signing is enabled
- name: Validate Signing Secrets - name: Validate Signing Secrets
if: ${{ inputs.signing }} if: ${{ inputs.signing }}
env:
HAS_CERT: ${{ secrets.CERTIFICATE_OSX_APPLICATION != '' }}
HAS_CERT_PASS: ${{ secrets.CERTIFICATE_PASSWORD != '' }}
HAS_APPLE_ID: ${{ secrets.APPLE_ID != '' }}
HAS_APPLE_PASS: ${{ secrets.APPLE_ID_PASSWORD != '' }}
HAS_TEAM_ID: ${{ secrets.APPLE_TEAM_ID != '' }}
run: | run: |
if [[ -z "${{ secrets.CERTIFICATE_OSX_APPLICATION }}" ]]; then missing=()
echo "Error: CERTIFICATE_OSX_APPLICATION secret is required for signing." [[ "${HAS_CERT}" != "true" ]] && missing+=("CERTIFICATE_OSX_APPLICATION")
exit 1 [[ "${HAS_CERT_PASS}" != "true" ]] && missing+=("CERTIFICATE_PASSWORD")
fi [[ "${HAS_APPLE_ID}" != "true" ]] && missing+=("APPLE_ID")
if [[ -z "${{ secrets.CERTIFICATE_PASSWORD }}" ]]; then [[ "${HAS_APPLE_PASS}" != "true" ]] && missing+=("APPLE_ID_PASSWORD")
echo "Error: CERTIFICATE_PASSWORD secret is required for signing." [[ "${HAS_TEAM_ID}" != "true" ]] && missing+=("APPLE_TEAM_ID")
exit 1
fi if (( ${#missing[@]} > 0 )); then
if [[ -z "${{ secrets.APPLE_ID }}" ]]; then echo "Error: Missing required signing secrets:"
echo "Error: APPLE_ID secret is required for signing." printf '%s\n' "${missing[@]}"
exit 1
fi
if [[ -z "${{ secrets.APPLE_ID_PASSWORD }}" ]]; then
echo "Error: APPLE_ID_PASSWORD secret is required for signing."
exit 1
fi
if [[ -z "${{ secrets.APPLE_TEAM_ID }}" ]]; then
echo "Error: APPLE_TEAM_ID secret is required for signing."
exit 1 exit 1
fi fi
echo "All required signing secrets are present." echo "All required signing secrets are present."
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
# Only pass ref if it's explicitly set, otherwise let checkout action use its default behavior
ref: ${{ inputs.ref != '' && inputs.ref || '' }}
fetch-depth: 0
- name: Debug git status
run: |
echo "=== Git Status ==="
git status
echo ""
echo "=== Current Commit ==="
git rev-parse HEAD
git rev-parse --abbrev-ref HEAD
echo ""
echo "=== Recent Commits ==="
git log --oneline -n 5
echo ""
echo "=== Remote Branches ==="
git branch -r
# Update versions before build # Update versions before build
- name: Update versions - name: Update versions
if: ${{ inputs.version != '' }} if: ${{ inputs.version != '' }}
env:
VERSION: ${{ inputs.version }}
run: | run: |
# Update version in Cargo.toml # Update version in Cargo.toml
sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml sed -i.bak "s/^version = \".*\"/version = \"${VERSION}\"/" Cargo.toml
rm -f Cargo.toml.bak rm -f Cargo.toml.bak
# Update version in package.json # Update version in package.json
cd ui/desktop cd ui/desktop
npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version npm version "${VERSION}" --no-git-tag-version --allow-same-version
# Pre-build cleanup to ensure enough disk space # Pre-build cleanup to ensure enough disk space
- name: Pre-build cleanup - name: Pre-build cleanup
@@ -194,6 +243,10 @@ jobs:
- name: Make Signed App - name: Make Signed App
if: ${{ inputs.signing }} if: ${{ inputs.signing }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: | run: |
attempt=0 attempt=0
max_attempts=2 max_attempts=2
@@ -208,10 +261,6 @@ jobs:
exit 1 exit 1
fi fi
working-directory: ui/desktop working-directory: ui/desktop
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Final cleanup before artifact upload - name: Final cleanup before artifact upload
run: | run: |
+62 -3
View File
@@ -28,9 +28,26 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
continue: ${{ steps.command.outputs.continue || github.event_name == 'workflow_dispatch' }} continue: ${{ steps.command.outputs.continue || github.event_name == 'workflow_dispatch' }}
# Cannot use github.event.pull_request.number since the trigger is 'issue_comment'
pr_number: ${{ steps.command.outputs.issue_number || github.event.inputs.pr_number }} pr_number: ${{ steps.command.outputs.issue_number || github.event.inputs.pr_number }}
pr_sha: ${{ steps.get_pr_info.outputs.sha }}
steps: steps:
- name: Debug workflow trigger
env:
WORKFLOW_NAME: ${{ github.workflow }}
WORKFLOW_REF: ${{ github.ref }}
EVENT_NAME: ${{ github.event_name }}
EVENT_ACTION: ${{ github.event.action }}
ACTOR: ${{ github.actor }}
REPOSITORY: ${{ github.repository }}
run: |
echo "=== Workflow Trigger Info ==="
echo "Workflow: ${WORKFLOW_NAME}"
echo "Ref: ${WORKFLOW_REF}"
echo "Event: ${EVENT_NAME}"
echo "Action: ${EVENT_ACTION}"
echo "Actor: ${ACTOR}"
echo "Repository: ${REPOSITORY}"
- if: ${{ github.event_name == 'issue_comment' }} - if: ${{ github.event_name == 'issue_comment' }}
uses: github/command@319d5236cc34ed2cb72a47c058a363db0b628ebe # pin@v1.3.0 uses: github/command@319d5236cc34ed2cb72a47c058a363db0b628ebe # pin@v1.3.0
id: command id: command
@@ -40,13 +57,51 @@ jobs:
reaction: "eyes" reaction: "eyes"
allowed_contexts: pull_request allowed_contexts: pull_request
# Get the PR's SHA
- name: Get PR info
id: get_pr_info
if: ${{ steps.command.outputs.continue == 'true' || github.event_name == 'workflow_dispatch' }}
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.inputs?.pr_number || core.getInput('command_issue_number');
if (!prNumber) {
throw new Error('No PR number found');
}
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: parseInt(prNumber, 10)
});
console.log('PR Details:', {
number: pr.number,
head: {
ref: pr.head.ref,
sha: pr.head.sha,
label: pr.head.label
},
base: {
ref: pr.base.ref,
sha: pr.base.sha,
label: pr.base.label
}
});
core.setOutput('sha', pr.head.sha);
inputs: |
{
"command_issue_number": "${{ steps.command.outputs.issue_number }}"
}
bundle-desktop: bundle-desktop:
# Only run this if ".bundle" command is detected.
needs: [trigger-on-command] needs: [trigger-on-command]
if: ${{ needs.trigger-on-command.outputs.continue == 'true' }} if: ${{ needs.trigger-on-command.outputs.continue == 'true' }}
uses: ./.github/workflows/bundle-desktop.yml uses: ./.github/workflows/bundle-desktop.yml
with: with:
signing: true signing: true
ref: ${{ needs.trigger-on-command.outputs.pr_sha }}
secrets: secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
@@ -69,13 +124,17 @@ jobs:
path: arm64-dist path: arm64-dist
- name: Comment on PR with ARM64 download link - name: Comment on PR with ARM64 download link
env:
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
PR_NUMBER: ${{ needs.trigger-on-command.outputs.pr_number }}
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # pin@v4 uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # pin@v4
with: with:
issue-number: ${{ needs.trigger-on-command.outputs.pr_number }} issue-number: ${{ needs.trigger-on-command.outputs.pr_number }}
body: | body: |
### macOS ARM64 Desktop App (Apple Silicon) ### macOS ARM64 Desktop App (Apple Silicon)
[📱 Download macOS Desktop App (arm64, signed)](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/Goose-darwin-arm64.zip) [📱 Download macOS Desktop App (arm64, signed)](https://nightly.link/${REPOSITORY}/actions/runs/${RUN_ID}/Goose-darwin-arm64.zip)
**Instructions:** **Instructions:**
After downloading, unzip the file and drag the Goose.app to your Applications folder. The app is signed and notarized for macOS. After downloading, unzip the file and drag the Goose.app to your Applications folder. The app is signed and notarized for macOS.