Skip to content

Commit

Permalink
GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
benbjohnson committed Jan 22, 2021
1 parent 02c2902 commit 234c6fb
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 6 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
release:
types:
- created

name: release
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2

- id: release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}

- name: build
run: |
GOOS=linux GOARCH=amd64 go build -ldflags "-X 'main.Version=${{ steps.release.outputs.tag_name }}'" -o ego ./cmd/ego
tar -czvf ego-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz ego
GOOS=darwin GOARCH=amd64 go build -ldflags "-X 'main.Version=${{ steps.release.outputs.tag_name }}'" -o ego ./cmd/ego
tar -czvf ego-${{ steps.release.outputs.tag_name }}-darwin-amd64.tar.gz ego
- name: upload linux
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./ego-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz
asset_name: ego-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz
asset_content_type: application/gzip

- name: upload darwin
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./ego-${{ steps.release.outputs.tag_name }}-darwin-amd64.tar.gz
asset_name: ego-${{ steps.release.outputs.tag_name }}-darwin-amd64.tar.gz
asset_content_type: application/gzip
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on: [push, pull_request]
name: test
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.15'

- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run unit tests
run: go test -v ./...
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ Ego [![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat

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.

## Usage
## Install

You can find release builds of ego for Mac OS & Linux on the [Releases page](https://github.com/benbjohnson/ego/releases).

To install ego:
To install ego from source, you can run this command outside of the `GOPATH`:

```sh
$ go get github.com/benbjohnson/ego/...
```

Then run `ego` on a directory. Recursively traverse the directory structure and generate Go files for all matching `.ego` files.

## Usage

Run `ego` on a directory. Recursively traverse the directory structure and generate Go files for all matching `.ego` files.

```sh
$ ego mypkg
Expand Down
6 changes: 3 additions & 3 deletions cmd/ego/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/benbjohnson/ego"
)

// version is set by the makefile during build.
var version string
// Version is set by the makefile during build.
var Version string

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

// If the version flag is set then print the version.
if *versionFlag {
fmt.Printf("ego v%s\n", version)
fmt.Printf("ego %s\n", Version)
return nil
}

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module github.com/benbjohnson/ego

go 1.13

0 comments on commit 234c6fb

Please sign in to comment.