Skip to content

Commit e81260d

Browse files
committed
maybe support arm on easy install.
1 parent 0d387a6 commit e81260d

3 files changed

Lines changed: 64 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ permissions:
99
contents: write
1010

1111
jobs:
12-
build-and-release:
13-
name: Build and release binary
12+
build:
13+
name: Build binary
1414
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
goos: [linux]
18+
goarch: [amd64, arm64]
1519
steps:
1620
- uses: actions/checkout@v4
1721
- uses: actions/setup-go@v4
@@ -31,8 +35,30 @@ jobs:
3135
run: npm install
3236
- uses: extractions/setup-just@v2
3337
- name: Build binary
34-
run: just build
38+
env:
39+
GOOS: ${{ matrix.goos }}
40+
GOARCH: ${{ matrix.goarch }}
41+
run: |
42+
just build
43+
mv pyramid-exe pyramid-${{ matrix.goarch }}
44+
- name: Upload artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: pyramid-${{ matrix.goarch }}
48+
path: pyramid-${{ matrix.goarch }}
49+
retention-days: 1
50+
51+
release:
52+
name: Create release
53+
needs: build
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Download artifacts
57+
uses: actions/download-artifact@v4
58+
with:
59+
pattern: pyramid-*
60+
merge-multiple: true
3561
- name: Create release
3662
uses: softprops/action-gh-release@v2
3763
with:
38-
files: pyramid-exe
64+
files: pyramid-*

easy.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,25 @@ ufw allow https
66

77
# download binary into ./pyramid directory
88
VERSION=$(curl -s "https://api.github.com/repos/fiatjaf/pyramid/releases/latest" | grep '"tag_name":' | cut -d '"' -f 4)
9+
case $(uname -m) in
10+
x86_64)
11+
ARCH="amd64"
12+
;;
13+
aarch64)
14+
ARCH="arm64"
15+
;;
16+
*)
17+
echo "unsupported architecture: $(uname -m)"
18+
exit 1
19+
;;
20+
esac
921
mkdir -p pyramid
1022
cd pyramid
11-
rm pyramid-exe-old
12-
mv pyramid-exe pyramid-exe-old
13-
wget "https://github.com/fiatjaf/pyramid/releases/download/$VERSION/pyramid-exe"
14-
chmod +x pyramid-exe
23+
rm pyramid-old
24+
mv pyramid pyramid-old 2>/dev/null || true
25+
wget "https://github.com/fiatjaf/pyramid/releases/download/$VERSION/pyramid-$ARCH"
26+
mv "pyramid-$ARCH" pyramid
27+
chmod +x pyramid
1528
DIR=$(pwd)
1629

1730
# create systemd service file
@@ -21,9 +34,10 @@ After=network.target
2134
2235
[Service]
2336
User=$USER
24-
ExecStart=$DIR/pyramid-exe
37+
ExecStart=$DIR/pyramid
2538
WorkingDirectory=$DIR
2639
Restart=always
40+
RestartSec=60
2741
Environment=HOST=0.0.0.0 PORT=443
2842
2943
[Install]

updates.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"os"
99
"path/filepath"
10+
"runtime"
1011
"syscall"
1112
"time"
1213

@@ -56,16 +57,27 @@ func fetchLatestVersion() {
5657
return
5758
}
5859

59-
// find the pyramid-exe asset
60+
// determine architecture and find the corresponding binary asset
6061
var binaryURL string
62+
var expectedBinaryName string
63+
switch runtime.GOARCH {
64+
case "amd64":
65+
expectedBinaryName = "pyramid-amd64"
66+
case "arm64":
67+
expectedBinaryName = "pyramid-arm64"
68+
default:
69+
log.Error().Str("arch", runtime.GOARCH).Msg("unsupported architecture")
70+
return
71+
}
72+
6173
for _, asset := range release.Assets {
62-
if asset.Name == "pyramid-exe" {
74+
if asset.Name == expectedBinaryName {
6375
binaryURL = asset.URL
6476
break
6577
}
6678
}
6779
if binaryURL == "" {
68-
log.Error().Msg("pyramid-exe asset not found in latest release")
80+
log.Error().Str("binary", expectedBinaryName).Msg("binary asset not found in latest release")
6981
return
7082
}
7183

0 commit comments

Comments
 (0)