Skip to content

Commit

Permalink
fix: improve build workflow file handling
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tak88r committed Feb 4, 2025
1 parent ba32d8e commit 461085f
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,37 @@ jobs:
- name: Run Tests
run: go test -v ./...

- name: Build Binaries
- name: Prepare Release Files
run: |
# Create dist directory
mkdir -p dist
# Create directories
mkdir -p dist/linux
mkdir -p dist/windows
mkdir -p dist/darwin
# Copy common files to each directory
for dir in dist/*; do
cp -r README.md LICENSE config "$dir/" || true
done
- name: Build Binaries
run: |
# Build for Linux
GOOS=linux GOARCH=amd64 go build -o dist/apkx-linux-amd64 ./cmd/apkx/main.go
tar czf dist/apkx-linux-amd64.tar.gz -C dist apkx-linux-amd64 LICENSE README.md config/
GOOS=linux GOARCH=amd64 go build -o dist/linux/apkx ./cmd/apkx/main.go
cd dist/linux
tar czf ../apkx-linux-amd64.tar.gz *
cd ../..
# Build for Windows
GOOS=windows GOARCH=amd64 go build -o dist/apkx-windows-amd64.exe ./cmd/apkx/main.go
zip -j dist/apkx-windows-amd64.zip dist/apkx-windows-amd64.exe LICENSE README.md
cp -r config dist/config-windows
zip -r dist/apkx-windows-amd64.zip dist/config-windows
GOOS=windows GOARCH=amd64 go build -o dist/windows/apkx.exe ./cmd/apkx/main.go
cd dist/windows
zip -r ../apkx-windows-amd64.zip *
cd ../..
# Build for macOS
GOOS=darwin GOARCH=amd64 go build -o dist/apkx-darwin-amd64 ./cmd/apkx/main.go
tar czf dist/apkx-darwin-amd64.tar.gz -C dist apkx-darwin-amd64 LICENSE README.md config/
GOOS=darwin GOARCH=amd64 go build -o dist/darwin/apkx ./cmd/apkx/main.go
cd dist/darwin
tar czf ../apkx-darwin-amd64.tar.gz *
cd ../..
- name: Create Release
uses: softprops/action-gh-release@v1
Expand Down

0 comments on commit 461085f

Please sign in to comment.