Skip to content

Commit

Permalink
Merge pull request #33 from sail-host/multi-platform-build
Browse files Browse the repository at this point in the history
feat: add make file prod build for multiple platforms
  • Loading branch information
Firdavs9512 authored Oct 30, 2024
2 parents f29d3f0 + 7d67171 commit 49ed601
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 8 deletions.
52 changes: 45 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ jobs:
go-version: "1.22"

- name: Build application
run: go build -o sailhost ./cmd/main.go
run: make prod

- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: sailhost
path: sailhost
path: |
sailhost-darwin-amd64.tar.gz
sailhost-darwin-arm64.tar.gz
sailhost-linux-amd64.tar.gz
sailhost-linux-arm64.tar.gz
release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -72,14 +76,48 @@ jobs:
uses: actions/download-artifact@v3
with:
name: sailhost
path: .
path: |
sailhost-darwin-amd64.tar.gz
sailhost-darwin-arm64.tar.gz
sailhost-linux-amd64.tar.gz
sailhost-linux-arm64.tar.gz
- name: Upload Application to Release
- name: Upload Darwin AMD64 to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sailhost
asset_name: sailhost
asset_content_type: application/octet-stream
asset_path: ./sailhost-darwin-amd64.tar.gz
asset_name: sailhost-darwin-amd64.tar.gz
asset_content_type: application/gzip

- name: Upload Darwin ARM64 to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sailhost-darwin-arm64.tar.gz
asset_name: sailhost-darwin-arm64.tar.gz
asset_content_type: application/gzip

- name: Upload Linux AMD64 to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sailhost-linux-amd64.tar.gz
asset_name: sailhost-linux-amd64.tar.gz
asset_content_type: application/gzip

- name: Upload Linux ARM64 to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sailhost-linux-arm64.tar.gz
asset_name: sailhost-linux-arm64.tar.gz
asset_content_type: application/gzip
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,21 @@ build:
@echo "Building web..."
cd web && bun run build
@echo "Building server..."
go build -o tmp/main cmd/web/main.go
go build -o tmp/main cmd/web/main.go

prod:
@echo "Build Mac AMD64"
GOOS=darwin GOARCH=amd64 go build -o sailhost-darwin-amd64 cmd/main.go
tar -czvf "sailhost-darwin-amd64.tar.gz" sailhost-darwin-amd64

@echo "Build Mac ARM64"
GOOS=darwin GOARCH=arm64 go build -o sailhost-darwin-arm64 cmd/main.go
tar -czvf "sailhost-darwin-arm64.tar.gz" sailhost-darwin-arm64

@echo "Build Linux AMD64"
GOOS=linux GOARCH=amd64 go build -o sailhost-linux-amd64 cmd/main.go
tar -czvf "sailhost-linux-amd64.tar.gz" sailhost-linux-amd64

@echo "Build Linux ARM64"
GOOS=linux GOARCH=arm64 go build -o sailhost-linux-arm64 cmd/main.go
tar -czvf "sailhost-linux-arm64.tar.gz" sailhost-linux-arm64

0 comments on commit 49ed601

Please sign in to comment.