Skip to content

Commit 234c6fb

Browse files
committed
GitHub Actions
1 parent 02c2902 commit 234c6fb

File tree

5 files changed

+79
-6
lines changed

5 files changed

+79
-6
lines changed

.github/workflows/release.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
on:
2+
release:
3+
types:
4+
- created
5+
6+
name: release
7+
jobs:
8+
linux:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-go@v2
13+
14+
- id: release
15+
uses: bruceadams/get-release@v1.2.2
16+
env:
17+
GITHUB_TOKEN: ${{ github.token }}
18+
19+
- name: build
20+
run: |
21+
GOOS=linux GOARCH=amd64 go build -ldflags "-X 'main.Version=${{ steps.release.outputs.tag_name }}'" -o ego ./cmd/ego
22+
tar -czvf ego-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz ego
23+
24+
GOOS=darwin GOARCH=amd64 go build -ldflags "-X 'main.Version=${{ steps.release.outputs.tag_name }}'" -o ego ./cmd/ego
25+
tar -czvf ego-${{ steps.release.outputs.tag_name }}-darwin-amd64.tar.gz ego
26+
27+
- name: upload linux
28+
uses: actions/upload-release-asset@v1.0.2
29+
env:
30+
GITHUB_TOKEN: ${{ github.token }}
31+
with:
32+
upload_url: ${{ steps.release.outputs.upload_url }}
33+
asset_path: ./ego-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz
34+
asset_name: ego-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz
35+
asset_content_type: application/gzip
36+
37+
- name: upload darwin
38+
uses: actions/upload-release-asset@v1.0.2
39+
env:
40+
GITHUB_TOKEN: ${{ github.token }}
41+
with:
42+
upload_url: ${{ steps.release.outputs.upload_url }}
43+
asset_path: ./ego-${{ steps.release.outputs.tag_name }}-darwin-amd64.tar.gz
44+
asset_name: ego-${{ steps.release.outputs.tag_name }}-darwin-amd64.tar.gz
45+
asset_content_type: application/gzip

.github/workflows/test.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
on: [push, pull_request]
2+
name: test
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/setup-go@v2
8+
with:
9+
go-version: '1.15'
10+
11+
- uses: actions/checkout@v2
12+
13+
- uses: actions/cache@v2
14+
with:
15+
path: ~/go/pkg/mod
16+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
17+
restore-keys: |
18+
${{ runner.os }}-go-
19+
20+
- name: Run unit tests
21+
run: go test -v ./...

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ Ego [![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat
33

44
Ego is an [ERb](http://ruby-doc.org/stdlib-2.1.0/libdoc/erb/rdoc/ERB.html) style templating language for Go. It works by transpiling templates into pure Go and including them at compile time. These templates are light wrappers around the Go language itself.
55

6-
## Usage
6+
## Install
7+
8+
You can find release builds of ego for Mac OS & Linux on the [Releases page](https://github.com/benbjohnson/ego/releases).
79

8-
To install ego:
10+
To install ego from source, you can run this command outside of the `GOPATH`:
911

1012
```sh
1113
$ go get github.com/benbjohnson/ego/...
1214
```
1315

14-
Then run `ego` on a directory. Recursively traverse the directory structure and generate Go files for all matching `.ego` files.
16+
17+
## Usage
18+
19+
Run `ego` on a directory. Recursively traverse the directory structure and generate Go files for all matching `.ego` files.
1520

1621
```sh
1722
$ ego mypkg

cmd/ego/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"github.com/benbjohnson/ego"
1313
)
1414

15-
// version is set by the makefile during build.
16-
var version string
15+
// Version is set by the makefile during build.
16+
var Version string
1717

1818
func main() {
1919
if err := run(os.Args[1:]); err != nil {
@@ -37,7 +37,7 @@ func run(args []string) error {
3737

3838
// If the version flag is set then print the version.
3939
if *versionFlag {
40-
fmt.Printf("ego v%s\n", version)
40+
fmt.Printf("ego %s\n", Version)
4141
return nil
4242
}
4343

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
module github.com/benbjohnson/ego
2+
3+
go 1.13

0 commit comments

Comments
 (0)