Skip to content

Commit

Permalink
Add release action (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmreadelf authored and auxten committed Sep 23, 2022
1 parent e67c669 commit b51007d
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: "ubuntu-latest"
container: "debian:10.3"
strategy:
matrix:
node-version: [14]
steps:
- name: Set up Go 1.18.x
uses: actions/setup-go@v2
with:
go-version: 1.18.x
id: go

- name: Instasll tools
shell: bash
run: "apt update && apt install make curl gcc ca-certificates zip git -y"

- name: Install gox
run: go install github.com/mitchellh/gox@master

- name: Instasll node apt repo
shell: bash
run: "curl -sL https://deb.nodesource.com/setup_14.x | bash -"

- name: Instasll node
shell: bash
run: "apt install nodejs -y"

- name: Step pnpm
uses: pnpm/[email protected]
with:
version: latest

- name: Checkout
uses: actions/checkout@v2

- name: Build frontend
run: make build-frontend

- name: Build go binary
shell: bash
run: gox -osarch='darwin/arm64 darwin/amd64 windows/arm64 windows/amd64 linux/arm64 linux/amd64' -ldflags="
-X main.Version=$(git describe --tags $(git rev-parse HEAD))
-X main.Commit=$(git rev-parse HEAD)" ./

- name: compress go binary
shell: bash
run: for i in edgeRec_*; do zip "$(echo $i | sed 's/\..*//').zip" $i; done

- name: Upload Release
uses: softprops/action-gh-release@v1
with:
files: edgeRec*.zip
draft: true
13 changes: 13 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"embed"
"flag"
"github.com/auxten/edgeRec/example/movielens"
nn "github.com/auxten/edgeRec/nn/neural_network"
rcmd "github.com/auxten/edgeRec/recommend"
Expand All @@ -12,7 +13,19 @@ import (
//go:embed frontend/website/*
var f embed.FS

var verFlag = flag.Bool("v", false, "show binary version")

var Version = "unknown-version"
var Commit = "unknown-commit"

func main() {
flag.Parse()
if *verFlag {
log.Println("Version: ", Version)
log.Println("Commit: ", Commit)
return
}

var (
recSys = &movielens.RecSysImpl{
DataPath: "movielens.db",
Expand Down

0 comments on commit b51007d

Please sign in to comment.