Skip to content

Commit

Permalink
Add new Release Workflow using Github Actions and wangyoucao577/go-re…
Browse files Browse the repository at this point in the history
…lease-action
  • Loading branch information
decke committed Feb 17, 2021
1 parent 7f34fcb commit 5ba64c5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 37 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release Go Binaries

on:
release:
types: [created]

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [freebsd, linux, windows]
goarch: ["386", amd64]
steps:
- uses: actions/checkout@v2

- name: Set APP_VERSION env
run: echo APP_VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev ) >> ${GITHUB_ENV}
- name: Set BUILD_TIME env
run: echo BUILD_TIME=$(date) >> ${GITHUB_ENV}

- uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://golang.org/dl/go1.15.8.linux-amd64.tar.gz"
extra_files: LICENSE README.md smtprelay.ini
ldflags: -s -w -X "main.appVersion=${{ env.APP_VERSION }}" -X "main.buildTime=${{ env.BUILD_TIME }}"
5 changes: 3 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"github.com/vharitonsky/iniflags"
)

const (
VERSION = "1.4.0"
var (
appVersion = "unknown"
buildTime = "unknown"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func main() {
ConfigLoad()

if *versionInfo {
fmt.Printf("smtprelay/%s\n", VERSION)
fmt.Printf("smtprelay/%s (%s)\n", appVersion, buildTime)
os.Exit(0)
}

Expand Down
34 changes: 0 additions & 34 deletions scripts/release.sh

This file was deleted.

0 comments on commit 5ba64c5

Please sign in to comment.