Compare commits

..

No commits in common. "369112af01d882d2b90d5d32421d9d1ebab382ee" and "791f9c06210ea3c7eb95b616e7d2af3d1581c43b" have entirely different histories.

4 changed files with 40 additions and 37 deletions

View File

@ -1,6 +1,5 @@
name: Build
on:
workflow_dispatch:
push:
paths:
- "**/*.go"
@ -26,8 +25,13 @@ jobs:
- darwin
GOARCH:
- "amd64"
- "386"
- "arm64"
exclude:
- GOOS: darwin
GOARCH: "386"
include:
- GOOS: windows
BIN_SUFFIX: ".exe"

3
.gitignore vendored
View File

@ -7,6 +7,3 @@
/um-*.tar.gz
/um-*.zip
/.vscode
/prepare
/dist

View File

@ -2,9 +2,9 @@
Original: Web Edition https://git.unlock-music.dev/um/web
- [![Build Status](https://git.unlock-music.dev/um/cli/actions/workflows/build.yml/badge.svg)](https://git.unlock-music.dev/um/cli/actions?workflow=build.yml)
- [![Build Status](https://ci.unlock-music.dev/api/badges/um/cli/status.svg)](https://ci.unlock-music.dev/um/cli)
- [Release Download](https://git.unlock-music.dev/um/cli/releases/latest)
- [Latest Build](https://git.unlock-music.dev/um/cli/actions)
- [Latest Build](https://git.unlock-music.dev/um/-/packages/generic/cli-build/)
> **WARNING**
> 在本站 fork 不会起到备份的作用,只会浪费服务器储存空间。如无必要请勿 fork 该仓库。
@ -36,3 +36,13 @@ It will produce `um` or `um.exe` (Windows).
- Drag the encrypted file to `um.exe` (Tested on Windows)
- Run: `./um [-o <output dir>] [-i] <input dir/file>`
- Use `./um -h` to show help menu
## Update CI pipeline
1. Install [Drone CI binary](https://docs.drone.io/cli/install/)
2. Edit `.drone.jsonnet`
3. Update drone CI pipeline:
```sh
drone jsonnet --format --stream
```

View File

@ -3,40 +3,32 @@
APP_VERSION="${1:-$(git describe --tags --always)}"
pack() {
local is_windows=0
local suffix=""
if [[ "$1" == *.exe ]]; then
suffix=".exe"
is_windows=1
fi
for exe in prepare/*/um-*.exe; do
name="$(basename "$exe" .exe)-$APP_VERSION"
new_exe="$(dirname "$exe")/um.exe"
mv "$exe" "$new_exe"
local exe_dir="$(dirname "$1")"
local archive_name="$(basename "$1" ".exe")-${APP_VERSION}"
local exe_name="um${suffix}"
echo "archiving ${new_exe}..."
zip -Xqj9 "dist/${name}.zip" "$new_exe"
rm -f "$new_exe"
done
echo "archiving ${exe_name}..."
for exe in prepare/*/um-*; do
name="$(basename "$exe")-$APP_VERSION"
new_exe="$(dirname "$exe")/um"
mv "$exe" "$new_exe"
mv "$1" "${exe_name}"
if [[ "$is_windows" == 1 ]]; then
echo zip -Xqj9 "dist/${archive_name}.zip" "${exe_name}" README.md LICENSE
exit 1
else
tar \
--sort=name --format=posix \
--pax-option=exthdr.name=%d/PaxHeaders/%f \
--pax-option=delete=atime,delete=ctime \
--clamp-mtime --mtime='1970-01-01T00:00:00Z' \
--numeric-owner --owner=0 --group=0 \
--mode=0755 -c \
"${exe_name}" README.md LICENSE |
gzip -9 >"dist/${archive_name}.tar.gz"
fi
rm -rf "$exe_dir" "${exe_name}"
}
for exe in prepare/*/um*; do
pack "$exe"
echo "archiving ${new_exe}..."
tar \
--sort=name --format=posix \
--pax-option=exthdr.name=%d/PaxHeaders/%f \
--pax-option=delete=atime,delete=ctime \
--clamp-mtime --mtime='1970-01-01T00:00:00Z' \
--numeric-owner --owner=0 --group=0 \
--mode=0755 \
-c -C "$(dirname "$exe")" um |
gzip -9 >"dist/${name}.tar.gz"
rm -f "$exe"
done
pushd dist