-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Skye
committed
Sep 27, 2024
0 parents
commit aa5667e
Showing
7 changed files
with
361 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,55 @@ | ||
name: Go Cross-Platform Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
go-version: ['1.20'] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ matrix.go-version }}- | ||
- name: Install dependencies | ||
run: go mod download | ||
|
||
- name: Build for ${{ matrix.os }} | ||
run: | | ||
if [[ "$RUNNER_OS" == "Linux" ]]; then | ||
GOOS=linux GOARCH=amd64 go build -o builds/SkyeCraft-linux | ||
elif [[ "$RUNNER_OS" == "macOS" ]]; then | ||
go build -o builds/SkyeCraft-macOS | ||
elif [[ "$RUNNER_OS" == "Windows" ]]; then | ||
GOOS=windows GOARCH=amd64 go build -ldflags="-H windowsgui" -o builds/SkyeCraft.exe | ||
fi | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: SkyeCraft | ||
path: builds/ |
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 @@ | ||
build.sh |
Binary file not shown.
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,5 @@ | ||
module example.com/app | ||
|
||
go 1.23.0 | ||
|
||
require github.com/webview/webview_go v0.0.0-20240831120633-6173450d4dd6 // indirect |
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,2 @@ | ||
github.com/webview/webview_go v0.0.0-20240831120633-6173450d4dd6 h1:VQpB2SpK88C6B5lPHTuSZKb2Qee1QWwiFlC5CKY4AW0= | ||
github.com/webview/webview_go v0.0.0-20240831120633-6173450d4dd6/go.mod h1:yE65LFCeWf4kyWD5re+h4XNvOHJEXOCOuJZ4v8l5sgk= |
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,33 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
|
||
webview "github.com/webview/webview_go" | ||
) | ||
|
||
func main() { | ||
// Create a new webview instance | ||
w := webview.New(true) // `true` enables debug mode | ||
defer w.Destroy() | ||
|
||
// Set window title and dimensions | ||
w.SetTitle("SkyeCraft") | ||
w.SetSize(800, 600, webview.HintNone) | ||
|
||
// Get the current working directory | ||
dir, err := os.Getwd() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
// Build the full path to the HTML file | ||
htmlPath := filepath.Join(dir, "skyecraft.html") | ||
|
||
// Load the local HTML file | ||
w.Navigate("file://" + htmlPath) | ||
|
||
// Run the webview instance | ||
w.Run() | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.