Skip to content

Commit

Permalink
Update BuildAll.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovler-Young authored Mar 31, 2024
1 parent 894319a commit 04b09a5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/BuildAll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check-update:
Build-All:
# The type of runner that the job will run on
runs-on: ubuntu-latest

Expand All @@ -29,7 +29,10 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- name: build cf-go
if: ${{ steps.checkout-tags.outputs.up-to-date }}
run: |
Expand All @@ -44,6 +47,7 @@ jobs:
cd /home/runner/work/cloudflared/cloudflared
git clone https://github.com/cloudflare/cloudflared --depth 1
cd cloudflared/cmd/cloudflared
# Get the list of supported architectures
supported_platforms=$(go tool dist list)
Expand All @@ -56,9 +60,19 @@ jobs:
# Build the binary
echo "Building for $GOOS/$GOARCH..."
CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH /home/runner/work/cloudflared/cloudflared/go/bin/go build -a -trimpath -installsuffix cgo -ldflags "-s -w -extldflags \"-static\"" .
CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH /home/runner/work/cloudflared/cloudflared/go/bin/go build -a -trimpath -installsuffix cgo -ldflags "-s -w -extldflags \"-static\"" . || {
echo "Warning: Build failed for $GOOS/$GOARCH" >&2
continue
}
# Compress the binary using UPX
upx cloudflared || {
echo "Warning: UPX compression failed for $GOOS/$GOARCH" >&2
continue
}
mv cloudflared cloudflared-$GOOS-$GOARCH
done
cd /home/runner/work/cloudflared/cloudflared
- uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 04b09a5

Please sign in to comment.