Skip to content

Commit ebbe17b

Browse files
leogdionclaude
andcommitted
fix: separate build and sync workflows to resolve hashFiles error
- Create new bushel-cloud-build.yml workflow for building binary - Build triggers on code changes (push to main/8-scheduled-job, PRs) - Sync workflow downloads pre-built binary from build workflow - Remove problematic hashFiles('**/Package.resolved') caching - Use dawidd6/action-download-artifact for cross-workflow downloads - Set 30-day artifact retention for scheduled sync compatibility Fixes #8 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 08464da commit ebbe17b

File tree

2 files changed

+75
-47
lines changed

2 files changed

+75
-47
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build bushel-cloud Binary
2+
3+
on:
4+
# Build on code changes to main branch
5+
push:
6+
branches:
7+
- main
8+
- 8-scheduled-job # For development/testing
9+
10+
# Allow manual trigger
11+
workflow_dispatch:
12+
13+
# Optional: Build on PRs for validation
14+
pull_request:
15+
16+
# Prevent concurrent builds
17+
concurrency:
18+
group: bushel-cloud-build-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
name: Build bushel-cloud
24+
runs-on: ubuntu-latest
25+
container: swift:6.2-noble
26+
timeout-minutes: 20
27+
28+
permissions:
29+
contents: read # Read repository code
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
- name: Verify Swift version
36+
run: |
37+
swift --version
38+
swift package --version
39+
40+
- name: Build bushel-cloud executable
41+
id: build
42+
run: |
43+
swift build -c release
44+
BIN_PATH=$(swift build -c release --show-bin-path)
45+
echo "bin-path=$BIN_PATH" >> $GITHUB_OUTPUT
46+
echo "Binary location: $BIN_PATH/bushel-cloud"
47+
ls -lh "$BIN_PATH/bushel-cloud"
48+
49+
- name: Create build metadata
50+
run: |
51+
cat > build-metadata.json <<EOF
52+
{
53+
"commit_sha": "${{ github.sha }}",
54+
"commit_ref": "${{ github.ref }}",
55+
"build_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
56+
"workflow_run_id": "${{ github.run_id }}",
57+
"workflow_run_number": "${{ github.run_number }}"
58+
}
59+
EOF
60+
cat build-metadata.json
61+
62+
- name: Upload binary artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: bushel-cloud-binary
66+
path: |
67+
${{ steps.build.outputs.bin-path }}/bushel-cloud
68+
build-metadata.json
69+
retention-days: 30 # Keep for 30 days to support scheduled syncs
70+
if-no-files-found: error

.github/workflows/cloudkit-sync.yml

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,62 +22,20 @@ concurrency:
2222
cancel-in-progress: true
2323

2424
jobs:
25-
build:
26-
name: Build bushel-cloud
27-
runs-on: ubuntu-latest
28-
container: swift:6.2-noble
29-
timeout-minutes: 20
30-
31-
permissions:
32-
contents: read # Read repository code
33-
34-
steps:
35-
- name: Checkout repository
36-
uses: actions/checkout@v4
37-
38-
- name: Verify Swift version
39-
run: |
40-
swift --version
41-
swift package --version
42-
43-
- name: Cache Swift build
44-
uses: actions/cache@v4
45-
with:
46-
path: .build
47-
key: ${{ runner.os }}-swift-build-${{ hashFiles('**/Package.resolved') }}
48-
restore-keys: |
49-
${{ runner.os }}-swift-build-
50-
51-
- name: Build bushel-cloud executable
52-
id: build
53-
run: |
54-
swift build -c release
55-
BIN_PATH=$(swift build -c release --show-bin-path)
56-
echo "bin-path=$BIN_PATH" >> $GITHUB_OUTPUT
57-
echo "Binary location: $BIN_PATH/bushel-cloud"
58-
ls -lh "$BIN_PATH/bushel-cloud"
59-
60-
- name: Upload binary for sync job
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: bushel-cloud-binary
64-
path: ${{ steps.build.outputs.bin-path }}/bushel-cloud
65-
retention-days: 1 # Short retention, only needed for sync job
66-
if-no-files-found: error
67-
6825
sync:
6926
name: Sync to CloudKit
70-
runs-on: ubuntu-latest # No container needed - uses pre-built binary
71-
needs: [build]
27+
runs-on: ubuntu-latest
7228
timeout-minutes: 30
7329

7430
permissions:
7531
contents: read # Read repository code
7632

7733
steps:
78-
- name: Download built binary
79-
uses: actions/download-artifact@v4
34+
- name: Download latest built binary
35+
uses: dawidd6/action-download-artifact@v3
8036
with:
37+
workflow: bushel-cloud-build.yml
38+
workflow_conclusion: success
8139
name: bushel-cloud-binary
8240
path: ./binary
8341

0 commit comments

Comments
 (0)