Skip to content

Commit

Permalink
Support multiple platform (#3)
Browse files Browse the repository at this point in the history
* WIP

* Support multiple platform
  • Loading branch information
ntk148v authored Nov 19, 2021
1 parent 76fc175 commit 5e78595
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ jobs:
uses: actions/checkout@v2

- name: Build & test
run: go build -ldflags "-s -w" -o /tmp/goignore *.go
run: |
GOOS=windows GOARCH=386 go build -ldflags "-s -w" -o build/goignore-x86.exe *.go
GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o build/goignore.exe *.go
GOOS=linux GOARCH=386 go build -ldflags "-s -w" -o build/goignore-x86 *.go
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o build/goignore *.go
GOOS=darwin GOARCH=386 go build -ldflags "-s -w" -o build/goignore-darwin-x86 *.go
GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o build/goignore-darwin *.go
- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: /tmp/goignore
files: |
build/*
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ A `.gitignore` wizard which gnerates `.gitignore` files from the command line fo
## 1. Features

- No installation necessary - just use the binary.
- Works on Linux.
- Works on Linux, Windows & MacOS.
- Interactive user interface with [bubbletea](https://github.com/charmbracelet/bubbletea): Pagination, Filtering, Help...
- Supports all Github-supported [.gitignore files](https://github.com/github/gitignore.git).

## 2. Install

- This tool is tested in Linux environment (Ubuntu 20.04).
- Download the latest binary from the [Release page](https://github.com/ntk148v/goignore/releases). It's the easiest way to get started with `goignore`.
- Make sure to add the location of the binary to your `$PATH`.

Expand Down
8 changes: 4 additions & 4 deletions templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (

const (
gitignoreUrl = "https://github.com/github/gitignore"
dataDir = ".cache/goignore"
dataDir = ".goignore"
)

var dataPath = path.Join(os.Getenv("HOME"), dataDir)
Expand Down Expand Up @@ -132,7 +132,7 @@ func downloadTemplates() error {
return cmd.Run()
}

archivePath := path.Join("/tmp", "gitignore.zip")
archivePath := path.Join(os.TempDir(), "gitignore.zip")
// Create the file
out, err := os.Create(archivePath)
if err != nil {
Expand All @@ -156,11 +156,11 @@ func downloadTemplates() error {
}

// Unzip to a temporary directory
if err = unzip(archivePath, "/tmp"); err != nil {
if err = unzip(archivePath, os.TempDir()); err != nil {
return err
}

err = shutil.CopyTree(path.Join("/tmp", "gitignore-master"), dataPath, nil)
err = shutil.CopyTree(path.Join(os.TempDir(), "gitignore-master"), dataPath, nil)
if err != nil {
return err
}
Expand Down

0 comments on commit 5e78595

Please sign in to comment.