Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e815debecc | |||
| b9d32c2adb | |||
| fea75a7be0 | |||
| 66dc7f7208 | |||
| 9d5aa39b00 | |||
| 9716b833a0 |
1 changed files with 61 additions and 74 deletions
|
|
@ -7,90 +7,77 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: 'Version tag (e.g. v1.0.0)'
|
description: 'Version tag (e.g. v1.0.1)'
|
||||||
required: false
|
required: false
|
||||||
default: 'dev'
|
default: 'v1.0.1'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-host
|
||||||
|
env:
|
||||||
|
FORGEJO_RELEASE_TOKEN: ${{ secrets.FORGEJO_RELEASE_TOKEN }}
|
||||||
|
GOPATH: /usr/local/go
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Prepare workspace
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.22'
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
id: version
|
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" = "push" ]; then
|
export PATH="/usr/local/go/bin:$PATH"
|
||||||
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
go version
|
||||||
else
|
rm -rf /tmp/ody-build && mkdir -p /tmp/ody-build/dist
|
||||||
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
git clone --depth=1 https://git.wellspr.ing/wellspring/ody-agent.git /tmp/ody-build/src
|
||||||
fi
|
ls /tmp/ody-build/src
|
||||||
|
|
||||||
- name: Build Windows
|
- name: Build all platforms
|
||||||
working-directory: ody-agent
|
|
||||||
run: |
|
run: |
|
||||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \
|
export PATH="/usr/local/go/bin:$PATH"
|
||||||
go build \
|
cd /tmp/ody-build/src
|
||||||
|
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build \
|
||||||
-ldflags "-s -w -H=windowsgui -X main.defaultServer=https://425.today" \
|
-ldflags "-s -w -H=windowsgui -X main.defaultServer=https://425.today" \
|
||||||
-o ../dist/ody-agent-win.exe .
|
-o /tmp/ody-build/dist/ody-agent-win.exe .
|
||||||
|
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build \
|
||||||
- name: Build macOS (Apple Silicon)
|
|
||||||
working-directory: ody-agent
|
|
||||||
run: |
|
|
||||||
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 \
|
|
||||||
go build \
|
|
||||||
-ldflags "-s -w -X main.defaultServer=https://425.today" \
|
-ldflags "-s -w -X main.defaultServer=https://425.today" \
|
||||||
-o ../dist/ody-agent-mac-arm64 .
|
-o /tmp/ody-build/dist/ody-agent-mac-arm64 .
|
||||||
|
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build \
|
||||||
- name: Build macOS (Intel)
|
|
||||||
working-directory: ody-agent
|
|
||||||
run: |
|
|
||||||
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 \
|
|
||||||
go build \
|
|
||||||
-ldflags "-s -w -X main.defaultServer=https://425.today" \
|
-ldflags "-s -w -X main.defaultServer=https://425.today" \
|
||||||
-o ../dist/ody-agent-mac-amd64 .
|
-o /tmp/ody-build/dist/ody-agent-mac-amd64 .
|
||||||
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \
|
||||||
- name: Build Linux
|
|
||||||
working-directory: ody-agent
|
|
||||||
run: |
|
|
||||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
|
|
||||||
go build \
|
|
||||||
-ldflags "-s -w -X main.defaultServer=https://425.today" \
|
-ldflags "-s -w -X main.defaultServer=https://425.today" \
|
||||||
-o ../dist/ody-agent-linux .
|
-o /tmp/ody-build/dist/ody-agent-linux .
|
||||||
|
echo "--- Artifacts ---"
|
||||||
|
ls -lh /tmp/ody-build/dist/
|
||||||
|
|
||||||
- name: List artifacts
|
- name: Publish Forgejo release
|
||||||
run: ls -lh dist/
|
run: |
|
||||||
|
export PATH="/usr/local/go/bin:$PATH"
|
||||||
- name: Create release
|
FORGEJO_URL="https://git.wellspr.ing"
|
||||||
uses: actions/gitea-release@v1
|
REPO="wellspring/ody-agent"
|
||||||
with:
|
if [ -n "$GITHUB_REF" ] && echo "$GITHUB_REF" | grep -q '^refs/tags/'; then
|
||||||
token: ${{ secrets.FORGEJO_TOKEN }}
|
VERSION="${GITHUB_REF#refs/tags/}"
|
||||||
tag_name: ${{ steps.version.outputs.VERSION }}
|
else
|
||||||
release_name: "Ody Agent ${{ steps.version.outputs.VERSION }}"
|
VERSION="v1.0.1"
|
||||||
body: |
|
fi
|
||||||
## Ody Agent ${{ steps.version.outputs.VERSION }}
|
echo "Publishing release: $VERSION"
|
||||||
|
echo "Token present: $([ -n "$FORGEJO_RELEASE_TOKEN" ] && echo yes || echo NO)"
|
||||||
Desktop agent for WellSpr.ing / NNN.today merchants.
|
EXISTING_ID=$(curl -sf "$FORGEJO_URL/api/v1/repos/$REPO/releases/tags/$VERSION" \
|
||||||
|
-H "Authorization: token $FORGEJO_RELEASE_TOKEN" 2>/dev/null \
|
||||||
### Downloads
|
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('id',''))" 2>/dev/null || echo "")
|
||||||
| Platform | File |
|
if [ -n "$EXISTING_ID" ]; then
|
||||||
|----------|------|
|
curl -sf -X DELETE "$FORGEJO_URL/api/v1/repos/$REPO/releases/$EXISTING_ID" \
|
||||||
| Windows (64-bit) | `ody-agent-win.exe` |
|
-H "Authorization: token $FORGEJO_RELEASE_TOKEN" && echo "Deleted old release $EXISTING_ID"
|
||||||
| macOS Apple Silicon | `ody-agent-mac-arm64` |
|
fi
|
||||||
| macOS Intel | `ody-agent-mac-amd64` |
|
RELEASE=$(curl -sf -X POST "$FORGEJO_URL/api/v1/repos/$REPO/releases" \
|
||||||
| Linux (64-bit) | `ody-agent-linux` |
|
-H "Authorization: token $FORGEJO_RELEASE_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
### Quick setup
|
-d "{\"tag_name\":\"$VERSION\",\"name\":\"Ody Agent $VERSION\",\"body\":\"Desktop agent for WellSpr.ing merchants.\",\"draft\":false}")
|
||||||
1. Download the binary for your platform
|
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
||||||
2. Get your `config.env` from the merchant dashboard → AI Agent tab
|
echo "Release ID: $RELEASE_ID"
|
||||||
3. Place both files in the same folder and run the agent
|
for f in /tmp/ody-build/dist/*; do
|
||||||
files: |
|
FNAME=$(basename "$f")
|
||||||
dist/ody-agent-win.exe
|
echo "Uploading $FNAME..."
|
||||||
dist/ody-agent-mac-arm64
|
curl -sf -X POST \
|
||||||
dist/ody-agent-mac-amd64
|
"$FORGEJO_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$FNAME" \
|
||||||
dist/ody-agent-linux
|
-H "Authorization: token $FORGEJO_RELEASE_TOKEN" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@$f"
|
||||||
|
echo "$FNAME uploaded."
|
||||||
|
done
|
||||||
|
echo "Done: $FORGEJO_URL/$REPO/releases/tag/$VERSION"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue