-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.4 KB
/
bushel-cloud-build.yml
File metadata and controls
86 lines (72 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Build bushel-cloud Binary
on:
# Build on code changes to main branch
push:
branches:
- main
# Allow manual trigger
workflow_dispatch:
# Build on PRs for validation
pull_request:
# Prevent concurrent builds
# Why cancel-in-progress?
# - Newer code changes supersede older builds
# - Saves CI minutes by canceling outdated builds
# - Each branch gets independent builds via ${{ github.ref }}
concurrency:
group: bushel-cloud-build-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build bushel-cloud
runs-on: ubuntu-latest
container: swift:6.2-noble
timeout-minutes: 20
permissions:
contents: read # Read repository code
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Verify Swift version
run: |
swift --version
swift package --version
- name: Build bushel-cloud executable
id: build
run: |
swift build -c release --static-swift-stdlib
BIN_PATH=$(swift build -c release --static-swift-stdlib --show-bin-path)
echo "bin-path=$BIN_PATH" >> $GITHUB_OUTPUT
echo "Binary location: $BIN_PATH/bushel-cloud"
ls -lh "$BIN_PATH/bushel-cloud"
- name: Prepare binary for upload
id: prepare
run: |
# Create a clean directory for the artifact
mkdir -p artifact
# Copy binary to artifact directory
cp "${{ steps.build.outputs.bin-path }}/bushel-cloud" artifact/
# Create build metadata
cat > artifact/build-metadata.json <<EOF
{
"commit_sha": "${{ github.sha }}",
"commit_ref": "${{ github.ref }}",
"build_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"workflow_run_id": "${{ github.run_id }}",
"workflow_run_number": "${{ github.run_number }}"
}
EOF
# Show what we're uploading
ls -lh artifact/
cat artifact/build-metadata.json
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: bushel-cloud-binary
path: artifact/
# Why 90 days?
# - Free repos get 90 days maximum retention
# - Provides 3x safety margin for 3x daily syncs
# - Fallback build handles expiration gracefully
retention-days: 90
if-no-files-found: error