Skip to content

Commit

Permalink
goreleaser 改造
Browse files Browse the repository at this point in the history
  • Loading branch information
LY1806620741 committed Jun 26, 2024
1 parent 640d6b7 commit 4fdace2
Show file tree
Hide file tree
Showing 8 changed files with 14,861 additions and 76 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/go.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: goreleaser

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v5

-
name: Set up Nodejs
uses: actions/setup-node@v4
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 0 additions & 27 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
/src/.umi-test
/dist
.swc

dist/
56 changes: 56 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

before:
hooks:
- npm install -g pnpm
- pnpm install
- pnpm build
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
- rm -rf dist

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
flags:
- -tags=withsource
overrides:
- goos: windows
- ldflags:
- -H windowsgui

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
13 changes: 10 additions & 3 deletions gofunction.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package main

import "log"
import (
"log"
"strconv"
)

var count = 0

func registerFunc() {
ui.Bind("query", func(any string) string {
log.Println("被调用" + any)
count += 1
log.Printf("被调用 传参%s 调用%d次", any, count)
ui.Eval(`
console.log("go invoke success")
console.log("go invoke success");
document.getElementById("callbackPrint").innerHTML="golang 回调测试` + strconv.Itoa(count) + `";
`)
return "query ok"
})
Expand Down
Loading

0 comments on commit 4fdace2

Please sign in to comment.