0.1.2-rc1
continuous-integration/drone/push Build was killed Details

pull/39/head
Evan Chen 2021-10-24 00:49:44 +08:00
parent db1f9f3ee8
commit 1a9e4c8d67
9 changed files with 75 additions and 35 deletions

33
.drone.yml Normal file
View File

@ -0,0 +1,33 @@
kind: pipeline
name: default
steps:
- name: build
image: golang
commands:
- bash release.sh cmd/configui/main.go
- name: gitea_release
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_api_key
base_url: https://kumoly.io
files: dist/*
checksum:
- sha256
- name: docker
image: plugins/docker
settings:
username:
from_secret: hub_user
password:
from_secret: hub_passwd
auto_tag: true
purge: true
repo: tools/configui
registry: hub.kumoly.io
when:
event: tag

View File

@ -29,30 +29,9 @@ web:
build:
go build ${LDFLAGS} -o dist/${PROJ} cmd/$(PROJ)/main.go
build-unix:
$(foreach GOOS, $(PLATFORMS), $(foreach GOARCH, $(ARCHITECTURES), $(foreach APP, $(APPS),\
$(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); go build ${LDFLAGS} -o dist/$(APP) cmd/$(APP)/main.go) \
$(shell cd dist; tar -czf ${APP}_$(VERSION)_$(GOOS)_$(GOARCH).tar.gz ${APP}) \
$(shell rm dist/${APP}) \
)))
build-win:
$(foreach APP, $(APPS), \
$(shell export GOOS=windows; export GOARCH=amd64; go build ${LDFLAGS} -o dist/${APP}.exe cmd/$(APP)/main.go) \
$(shell cd dist; tar -czf ${APP}_$(VERSION)_windows_amd64.tar.gz ${APP}.exe) \
$(shell rm dist/${APP}.exe) \
)
build-mac-m1:
$(foreach APP, $(APPS),\
$(shell export GOOS=darwin; export GOARCH=arm64; go build ${LDFLAGS} -o dist/$(APP) cmd/$(APP)/main.go) \
$(shell cd dist; tar -czf ${APP}_$(VERSION)_darwin_arm64.tar.gz ${APP}) \
$(shell rm dist/${APP}) \
)
.PHONY: binary
binary: build-unix build-win build-mac-m1
binary:
bash release.sh cmd/configui/main.go
.PHONY: docker
docker:

4
app.go
View File

@ -24,6 +24,8 @@ type Editor struct {
type Page struct {
AppName string
Version string
Build string
Files []ActiveFile
Error string
File ActiveFile
@ -68,6 +70,8 @@ func (cui *ConfigUI) App(w http.ResponseWriter, r *http.Request) {
Static: cui.NoReconfig,
HideConfig: cui.HideConfig,
ResultBellow: cui.ResultBellow,
Version: version,
Build: build,
}
content := ""

View File

@ -13,6 +13,9 @@ import (
var UNIX_SHELL = "sh"
var WIN_SHELL = "cmd"
const version = "0.1.2-rc1"
const build = "97d2e08"
//go:embed templates
var tmplFS embed.FS

1
log.go Normal file
View File

@ -0,0 +1 @@
package configui

File diff suppressed because one or more lines are too long

34
release.sh Normal file → Executable file
View File

@ -1,19 +1,31 @@
VERSION=$(git describe --tags --abbrev=0)
BUILD=$(git rev-parse --short HEAD)
PROJ=$(basename "$(PWD)")
PROJ=$(basename "$(pwd)")
HUB=hub.kumoly.io
HUB_PROJECT=tools
LDFLAGS='-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD} -w"'
DIST=dist
PLATFORMS='darwin linux'
ARCHITECTURES=amd64
APPS=configui
LDFLAGS="-ldflags \"-X main.Version=${VERSION} -X main.Build=${BUILD} -w\""
FAILURES=""
echo $LDFLAGS
PLATFORMS="darwin/amd64 darwin/arm64"
PLATFORMS="$PLATFORMS windows/amd64" # arm compilation not available for Windows
PLATFORMS="$PLATFORMS linux/amd64"
build(){
foreach GOOS $1
echo $GOOS
}
build $PLATFORMS
for PLATFORM in $PLATFORMS; do
GOOS=${PLATFORM%/*}
GOARCH=${PLATFORM#*/}
BIN_FILENAME="${PROJ}"
if [[ "${GOOS}" == "windows" ]]; then BIN_FILENAME="${BIN_FILENAME}.exe"; fi
CMD="GOOS=${GOOS} GOARCH=${GOARCH} go build ${LDFLAGS} -o ${DIST}/${BIN_FILENAME} $@"
echo "${CMD}"
eval $CMD || FAILURES="${FAILURES} ${PLATFORM}"
sh -c "cd ${DIST} && zip ${PROJ}-${VERSION}-${GOOS}-${GOARCH}.zip ${BIN_FILENAME} && rm ${BIN_FILENAME}"
done
if [[ "${FAILURES}" != "" ]]; then
echo ""
echo "${SCRIPT_NAME} failed on: ${FAILURES}"
exit 1
fi

View File

@ -2,6 +2,7 @@
$modal-content-width: 90vw;
$footer-padding: 0.5rem 1.5rem 0.5rem;
@import "../node_modules/bulma/bulma.sass";
@import "../node_modules/@creativebulma/bulma-tooltip/src/sass/index.sass";

View File

@ -1,4 +1,11 @@
{{define "base/footer"}}
<footer class="footer">
<div class="content has-text-right">
<p>
<strong>Configui</strong> {{.Version}}-{{.Build}} by <a href="https://kumoly.io/evanchen">Evan Chen</a>.
</p>
</div>
</footer>
<script src="/public/ace/js/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="/public/ace/js/ext-beautify.js" type="text/javascript" charset="utf-8"></script>
{{template "base/script" .}}