Compare commits
2 Commits
v0.2.5
...
Release-nf
Author | SHA1 | Date | |
---|---|---|---|
cbb959a31e | |||
b267cc7a2e |
62
.github/workflows/nfctl.yml
vendored
Normal file
62
.github/workflows/nfctl.yml
vendored
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
name: Auto Build
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
env:
|
||||||
|
RELEASE_VERSION: v24.07.13-r1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-job:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
repository-projects: write
|
||||||
|
steps:
|
||||||
|
- name: checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: install golang
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: '1.20'
|
||||||
|
|
||||||
|
- name: build linux amd64
|
||||||
|
run: CGO_ENABLE=0 GOOS=linux GOARCH=amd64 go build -ldflags='-s -w' -o "dist/nfctl-linux_amd64-${{ env.RELEASE_VERSION }}" nft/nfctl/main.go
|
||||||
|
|
||||||
|
- name: build linux arm64
|
||||||
|
run: CGO_ENABLE=0 GOOS=linux GOARCH=arm64 go build -ldflags='-s -w' -o "dist/nfctl-linux_arm64-${{ env.RELEASE_VERSION }}" nft/nfctl/main.go
|
||||||
|
|
||||||
|
- name: build windows amd64
|
||||||
|
run: CGO_ENABLE=0 GOOS=windows GOARCH=amd64 go build -ldflags='-s -w' -o "dist/nfctl-win_amd64-${{ env.RELEASE_VERSION }}.exe" nft/nfctl/main.go
|
||||||
|
|
||||||
|
- name: build windows arm64
|
||||||
|
run: CGO_ENABLE=0 GOOS=windows GOARCH=arm64 go build -ldflags='-s -w' -o "dist/nfctl-win_arm64-${{ env.RELEASE_VERSION }}.exe" nft/nfctl/main.go
|
||||||
|
|
||||||
|
- name: build darwin amd64
|
||||||
|
run: CGO_ENABLE=0 GOOS=darwin GOARCH=amd64 go build -ldflags='-s -w' -o "dist/nfctl-darwin_arm64-${{ env.RELEASE_VERSION }}" nft/nfctl/main.go
|
||||||
|
|
||||||
|
- name: build darwin arm64
|
||||||
|
run: CGO_ENABLE=0 GOOS=darwin GOARCH=arm64 go build -ldflags='-s -w' -o "dist/nfctl-darwin_arm64-${{ env.RELEASE_VERSION }}" nft/nfctl/main.go
|
||||||
|
|
||||||
|
- name: show all builds
|
||||||
|
run: ls -lash dist
|
||||||
|
|
||||||
|
- name: create releases
|
||||||
|
id: create_releases
|
||||||
|
uses: "marvinpinto/action-automatic-releases@latest"
|
||||||
|
with:
|
||||||
|
automatic_release_tag: "Release-nfctl-${{ env.RELEASE_VERSION }}"
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
title: "Release_${{ env.RELEASE_VERSION }}"
|
||||||
|
prerelease: false
|
||||||
|
files: |
|
||||||
|
dist/nfctl-linux_amd64-${{ env.RELEASE_VERSION }}
|
||||||
|
dist/nfctl-linux_arm64-${{ env.RELEASE_VERSION }}
|
||||||
|
dist/nfctl-win_amd64-${{ env.RELEASE_VERSION }}.exe
|
||||||
|
dist/nfctl-win_arm64-${{ env.RELEASE_VERSION }}.exe
|
||||||
|
dist/nfctl-darwin_arm64-${{ env.RELEASE_VERSION }}
|
||||||
|
dist/nfctl-darwin_arm64-${{ env.RELEASE_VERSION }}
|
@ -126,6 +126,8 @@ func initNew() {
|
|||||||
log.Warn("remove .git folder err: %s", err.Error())
|
log.Warn("remove .git folder err: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Info("🎉 create project [%s] 成功!!!", args[0])
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/loveuer/nf/nft/nfctl/version"
|
"github.com/loveuer/nf/nft/nfctl/version"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -16,4 +17,10 @@ func main() {
|
|||||||
defer version.Fn()
|
defer version.Fn()
|
||||||
|
|
||||||
_ = cmd.Root.ExecuteContext(ctx)
|
_ = cmd.Root.ExecuteContext(ctx)
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-time.After(3 * time.Second):
|
||||||
|
case <-ctx.Done():
|
||||||
|
case <-version.OkCh:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Version = "v24.07.12-r1"
|
const Version = "v24.07.13-r1"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
lk = &sync.Mutex{}
|
lk = &sync.Mutex{}
|
||||||
@ -19,13 +19,14 @@ var (
|
|||||||
upgrade = func(v string) func() {
|
upgrade = func(v string) func() {
|
||||||
return func() {
|
return func() {
|
||||||
color.Green("\n🎉 🎉 🎉 [nfctl] New Version Found: %s", v)
|
color.Green("\n🎉 🎉 🎉 [nfctl] New Version Found: %s", v)
|
||||||
color.Cyan("Upgrade it with: [go install github.com/loveuer/nf/nft/nfctl@latest]")
|
color.Cyan("Upgrade it with: [go install github.com/loveuer/nf/nft/nfctl@master]")
|
||||||
fmt.Print("Or Download by: ")
|
fmt.Print("Or Download by: ")
|
||||||
color.Cyan(termlink.Link("Releases", "https://github.com/loveuer/nf/releases"))
|
color.Cyan(termlink.Link("Releases", "https://github.com/loveuer/nf/releases"))
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Fn = empty
|
Fn = empty
|
||||||
|
OkCh = make(chan struct{}, 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
func Check() {
|
func Check() {
|
||||||
@ -57,6 +58,7 @@ func Check() {
|
|||||||
lk.Lock()
|
lk.Lock()
|
||||||
Fn = upgrade(v)
|
Fn = upgrade(v)
|
||||||
lk.Unlock()
|
lk.Unlock()
|
||||||
|
OkCh <- struct{}{}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user