Skip to content

Commit

Permalink
build: v1.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ptma committed Jun 26, 2024
0 parents commit 4a7225c
Show file tree
Hide file tree
Showing 18 changed files with 396 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file is for unifying the coding style for different editors and IDEs.
# More information at http://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.go]
indent_style = tab
112 changes: 112 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: build

on:
workflow_dispatch:
push:
tags:
- '*'

env:
# don't auto-upgrade the gotoolchain
# https://github.com/docker-library/golang/issues/472
GOTOOLCHAIN: local

jobs:
run:
runs-on: windows-latest
env:
GO_VERSION: '1.21'
NODE_VERSION: '16'
JAVA_VERSION: '11'
ANT_VERSION: '1.10.8'
JAVA_TOOL_OPTIONS: '-Dfile.encoding=UTF8'
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
-
name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
-
name: Set up Java
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
-
name: Set up ANT
run: |
choco install ant --no-progress --force -y --version $Env:ANT_VERSION
$Env:PATH = "C:\ProgramData\chocolatey\lib\ant\tools\apache-ant-$Env:ANT_VERSION\bin;$Env:PATH"
echo "ANT_HOME=C:\ProgramData\chocolatey\lib\ant\tools\apache-ant-$Env:ANT_VERSION" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
-
name: Java version
run: |
java -XshowSettings:properties -version
-
name: ANT version
run: |
ant -version
-
name: Node version
run: |
node --version
-
name: Config
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "$(go env GOPATH)/bin/windows_386" >> $GITHUB_PATH
echo "PORTAPPS_VERSION=$(cat go.mod | grep github.com/portapps/portapps | awk '{print $NF}')" >> $GITHUB_ENV
echo "PORTAPPS_DIR=./.portapps" >> $GITHUB_ENV
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "GIT_TAGNAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
fi
shell: bash
-
name: Checkout core
uses: actions/checkout@v4
with:
repository: portapps/portapps
ref: ${{ env.PORTAPPS_VERSION }}
path: ${{ env.PORTAPPS_DIR }}
-
name: Cache Portapps bin
uses: actions/cache@v4
with:
path: ${{ env.PORTAPPS_DIR }}/bin
key: portapps-bin-${{ env.PORTAPPS_VERSION }}
-
name: Build
run: |
ant release -Dcore.dir=${{ env.PORTAPPS_DIR }}
shell: bash
-
name: Upload assets
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: bin/release/*
-
name: GitHub Release
uses: crazy-max/ghaction-github-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
bin/release/*
name: ${{ env.GIT_TAGNAME }}
token: ${{ secrets.REPO_TOKEN }}
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v2
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Intellij
/.idea
/*.iml

# App
/.dev
/bin
/vendor
/*.syso
/*.exe
/versioninfo.json
/package-lock.json
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.6.6-1 (2024/06/26)

* Initial version based on 1.6.6
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 ptma

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## About

本项目为 AnotherRedisDesktopManager 便携版打包工程,使用 🚀 [Portapps](https://github.com/portapps/portapps) 制作,制作过程不会篡改 AnotherRedisDesktopManager 应用中的任何文件。

AnotherRedisDesktopManager 官网: https://github.com/qishibo/AnotherRedisDesktopManager
25 changes: 25 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Portapps
core.dir = ../portapps

# App
app = AnotherRedisDesktopManager
app.name = AnotherRedisDesktopManager
app.type = archive
app.version = 1.6.6
app.release = 1
app.homepage = https://github.com/qishibo/AnotherRedisDesktopManager

# Portable app
papp.id = ${app}-portable
papp.guid = {077A0495-019D-454B-835C-5BCD489FB0D5}
papp.name = ${app.name} Portable
papp.desc = ${app.name} portable on Windows
papp.url = https://github.com/PortableApplications/${papp.id}
papp.folder = app

# Official artifacts
atf.id = apifox
atf.win64.filename = AnotherRedisDesktopManager-${app.version}-setup
atf.win64.ext = .exe
atf.win64.url = https://github.com/qishibo/AnotherRedisDesktopManager/releases/download/v${app.version}/Another-Redis-Desktop-Manager.${app.version}.exe
atf.win64.assertextract = $PLUGINSDIR/app-64.7z
39 changes: 39 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="AnotherRedisDesktopManager" basedir=".">

<dirname property="app.basedir" file="${ant.file.AnotherRedisDesktopManager}"/>
<property name="build.properties" value="${app.basedir}/build.properties"/>
<property file="${build.properties}"/>

<!-- Load Portapps core build -->
<property name="core.basedir" location="${app.basedir}\${core.dir}"/>
<fail unless="core.basedir" message="Core directory '${core.basedir}' not found in ${core.basedir}"/>
<echo message="Core found in ${core.basedir}" level="debug"/>

<!-- Import build-app.xml -->
<import file="${core.basedir}\.build\build-app.xml"/>

<!-- Targets -->
<target name="release" depends="release.app" description="Release"/>

<target name="prepare" depends="load.lib.asar">
<echo message="Preparing release..."/>

<echo message="Extracting embedded ${atf.arch} archive"/>
<property name="extract.path2" value="${tmp.path}\extract2"/>
<if>
<equals arg1="${atf.arch}" arg2="win32"/>
<then>
<sevenzip-ax src="${extract.path}\$PLUGINSDIR\app-32.7z" dest="${extract.path2}"/>
</then>
<else>
<sevenzip-ax src="${extract.path}\$PLUGINSDIR\app-64.7z" dest="${extract.path2}"/>
</else>
</if>
<delete dir="${extract.path}"/>
<move todir="${extract.path}">
<fileset dir="${extract.path2}" defaultexcludes="no"/>
</move>
</target>

</project>
18 changes: 18 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module github.com/portapps/AnotherRedisDesktopManager-portable

go 1.21

require github.com/portapps/portapps/v3 v3.10.0

require (
github.com/akavel/rsrc v0.10.2 // indirect
github.com/ilya1st/rotatewriter v0.0.0-20171126183947-3df0c1a3ed6d // indirect
github.com/josephspurrier/goversioninfo v1.4.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rs/zerolog v1.32.0 // indirect
golang.org/x/sys v0.18.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
41 changes: 41 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/ilya1st/rotatewriter v0.0.0-20171126183947-3df0c1a3ed6d h1:OGuVAVny/97zsQ5BWg0mOjzTBBD9zR+Lug1co144+rU=
github.com/ilya1st/rotatewriter v0.0.0-20171126183947-3df0c1a3ed6d/go.mod h1:S1q6q+21PRGd0WRX+fHjQ+TOe3CgpSv7zgCWnZcbxCs=
github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8=
github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/portapps/portapps/v3 v3.10.0 h1:wrJrzoog3n8TMp7XiYpN279mDxLziwrTDklchGvCkhU=
github.com/portapps/portapps/v3 v3.10.0/go.mod h1:u5eNDI5dB3/vaejW/X3oPvYYlfjErIgTsabJvsXybOU=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
66 changes: 66 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//go:generate go install -v github.com/josephspurrier/goversioninfo/cmd/goversioninfo
//go:generate goversioninfo -icon=res/papp.ico -manifest=res/papp.manifest
package main

import (
"os"
"path"

"github.com/portapps/portapps/v3"
"github.com/portapps/portapps/v3/pkg/log"
"github.com/portapps/portapps/v3/pkg/utl"
)

type config struct {
Cleanup bool `yaml:"cleanup" mapstructure:"cleanup"`
}

var (
app *portapps.App
cfg *config
)

func init() {
var err error

// Default config
cfg = &config{
Cleanup: false,
}

// Init app
if app, err = portapps.NewWithCfg("AnotherRedisDesktopManager-portable", "AnotherRedisDesktopManager", cfg); err != nil {
log.Fatal().Err(err).Msg("Cannot initialize application. See log file for more info.")
}
}

func main() {
utl.CreateFolder(app.DataPath)
app.Process = utl.PathJoin(app.AppPath, "Another Redis Desktop Manager.exe")
app.Args = []string{
"--user-data-dir=" + app.DataPath,
}

// Cleanup on exit
if cfg.Cleanup {
defer func() {
utl.Cleanup([]string{
path.Join(os.Getenv("APPDATA"), "AnotherRedisDesktopManager"),
})
}()
}

configFile := utl.PathJoin(app.DataPath, "config.yaml")
if !utl.Exists(configFile) {
log.Info().Msg("Creating default config...")
if err := utl.WriteToFile(configFile, `enableAutomaticUpdates: false`); err != nil {
log.Error().Err(err).Msg("Cannot write default config")
}
}
if err := utl.ReplaceByPrefix(configFile, "enableAutomaticUpdates:", "enableAutomaticUpdates: false"); err != nil {
log.Fatal().Err(err).Msg("Cannot set enableAutomaticUpdates property")
}

defer app.Close()
app.Launch(os.Args[1:])
}
Binary file added res/app.ico
Binary file not shown.
Binary file added res/papp.ico
Binary file not shown.
22 changes: 22 additions & 0 deletions res/papp.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--This Id value indicates the application supports Windows 7 functionality-->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--This Id value indicates the application supports Windows 8 functionality-->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--This Id value indicates the application supports Windows 8.1 functionality-->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--This Id value indicates the application supports Windows 10 functionality-->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Binary file added res/papp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4a7225c

Please sign in to comment.