Compare commits

...

4 Commits

Author SHA1 Message Date
Yasuhiro Matsumoto
120a92920e switch to softprops/action-gh-release 2026-01-17 15:41:36 +09:00
fiatjaf
c6da13649d hopefully eliminate the weird case of cron and githubactions calling nak with an empty stdin and causing it to do nothing.
closes https://github.com/fiatjaf/nak/issues/90
2026-01-16 16:11:07 -03:00
Yasuhiro Matsumoto
acd6227dd0 fix darwin build 2026-01-16 15:17:29 -03:00
mattn
00fbda9af7 use native runner and install macfuse 2026-01-16 13:43:19 -03:00
3 changed files with 37 additions and 18 deletions

View File

@@ -9,30 +9,17 @@ permissions:
contents: write contents: write
jobs: jobs:
make-release:
runs-on: ubuntu-latest
steps:
- uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
build-all-for-all: build-all-for-all:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs:
- make-release
strategy: strategy:
matrix: matrix:
goos: [linux, freebsd, darwin, windows] goos: [linux, freebsd, windows]
goarch: [amd64, arm64, riscv64] goarch: [amd64, arm64, riscv64]
exclude: exclude:
- goarch: arm64 - goarch: arm64
goos: windows goos: windows
- goarch: riscv64 - goarch: riscv64
goos: windows goos: windows
- goarch: riscv64
goos: darwin
- goarch: arm64 - goarch: arm64
goos: freebsd goos: freebsd
steps: steps:
@@ -47,6 +34,31 @@ jobs:
md5sum: false md5sum: false
sha256sum: false sha256sum: false
compress_assets: false compress_assets: false
build-darwin:
runs-on: macos-latest
strategy:
matrix:
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Install macFUSE
run: brew install --cask macfuse
- name: Build binary
env:
GOOS: darwin
GOARCH: ${{ matrix.goarch }}
run: |
go build -ldflags "-X main.version=${{ github.ref_name }}" -o nak-${{ github.ref_name }}-darwin-${{ matrix.goarch }}
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
with:
files: ./nak-${{ github.ref_name }}-darwin-${{ matrix.goarch }}
smoke-test-linux-amd64: smoke-test-linux-amd64:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
@@ -102,7 +114,7 @@ jobs:
# test NIP-49 key encryption/decryption # test NIP-49 key encryption/decryption
echo "testing NIP-49 key encryption/decryption..." echo "testing NIP-49 key encryption/decryption..."
ENCRYPTED_KEY=$(./nak key encrypt $SECRET_KEY "testpassword") ENCRYPTED_KEY=$(./nak key encrypt $SECRET_KEY "testpassword")
echo "encrypted key: ${ENCRYPTED_KEY:0:20}..." echo "encrypted key: ${ENCRYPTED_KEY: 0:20}..."
DECRYPTED_KEY=$(./nak key decrypt $ENCRYPTED_KEY "testpassword") DECRYPTED_KEY=$(./nak key decrypt $ENCRYPTED_KEY "testpassword")
if [ "$DECRYPTED_KEY" != "$SECRET_KEY" ]; then if [ "$DECRYPTED_KEY" != "$SECRET_KEY" ]; then
echo "nip-49 encryption/decryption test failed!" echo "nip-49 encryption/decryption test failed!"

View File

@@ -155,6 +155,7 @@ example:
os.Exit(3) os.Exit(3)
} }
} }
kr, sec, err := gatherKeyerFromArguments(ctx, c) kr, sec, err := gatherKeyerFromArguments(ctx, c)
if err != nil { if err != nil {
return err return err

View File

@@ -46,8 +46,14 @@ var (
) )
func isPiped() bool { func isPiped() bool {
stat, _ := os.Stdin.Stat() stat, err := os.Stdin.Stat()
return stat.Mode()&os.ModeCharDevice == 0 if err != nil {
panic(err)
}
mode := stat.Mode()
is := mode&os.ModeCharDevice == 0
return is
} }
func getJsonsOrBlank() iter.Seq[string] { func getJsonsOrBlank() iter.Seq[string] {
@@ -76,7 +82,7 @@ func getJsonsOrBlank() iter.Seq[string] {
return true return true
}) })
if !hasStdin && !isPiped() { if !hasStdin {
yield("{}") yield("{}")
} }