-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions workflow for automated releases and build script
- Loading branch information
1 parent
7ad9af3
commit a4ac2cd
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.23.5" | ||
|
||
- name: Run build script | ||
run: ./scripts/build.sh | ||
|
||
- name: Upload binaries | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: binaries | ||
path: bin/ | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
bin/printlayout-linux-amd64 | ||
bin/printlayout-darwin-amd64 | ||
bin/printlayout-windows-amd64.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
OUTPUT_DIR="bin" | ||
mkdir -p $OUTPUT_DIR | ||
|
||
PLATFORMS=( | ||
"windows/amd64" | ||
"linux/amd64" | ||
"darwin/amd64" | ||
) | ||
|
||
for PLATFORM in "${PLATFORMS[@]}"; do | ||
OS=$(echo $PLATFORM | cut -d'/' -f1) | ||
ARCH=$(echo $PLATFORM | cut -d'/' -f2) | ||
OUTPUT_NAME="printlayout-$OS-$ARCH" | ||
|
||
if [ "$OS" = "windows" ]; then | ||
OUTPUT_NAME="$OUTPUT_NAME.exe" | ||
fi | ||
|
||
echo "Building for $OS/$ARCH..." | ||
env GOOS=$OS GOARCH=$ARCH go build -o "$OUTPUT_DIR/$OUTPUT_NAME" ./cmd/main.go | ||
done | ||
|
||
echo "Binaries built successfully in the $OUTPUT_DIR directory." |