test: minimal workflow to diagnose runner
This commit is contained in:
parent
9716b833a0
commit
9d5aa39b00
1 changed files with 6 additions and 69 deletions
|
|
@ -1,78 +1,15 @@
|
||||||
name: Build and Release Ody Agent
|
name: Build Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: 'Version tag (e.g. v1.0.0)'
|
|
||||||
required: false
|
|
||||||
default: 'dev'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: https://github.com/actions/checkout@v4
|
- name: Check environment
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: https://github.com/actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.22'
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
id: version
|
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" = "push" ]; then
|
echo "Hello from Hetzner CI!"
|
||||||
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
uname -a
|
||||||
else
|
go version || echo "go not installed"
|
||||||
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
ls /usr/local/go/bin/ || echo "no go dir"
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build all platforms
|
|
||||||
run: |
|
|
||||||
mkdir -p dist
|
|
||||||
cd ody-agent
|
|
||||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \
|
|
||||||
go build -ldflags "-s -w -H=windowsgui -X main.defaultServer=https://425.today" \
|
|
||||||
-o ../dist/ody-agent-win.exe .
|
|
||||||
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 \
|
|
||||||
go build -ldflags "-s -w -X main.defaultServer=https://425.today" \
|
|
||||||
-o ../dist/ody-agent-mac-arm64 .
|
|
||||||
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 \
|
|
||||||
go build -ldflags "-s -w -X main.defaultServer=https://425.today" \
|
|
||||||
-o ../dist/ody-agent-mac-amd64 .
|
|
||||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
|
|
||||||
go build -ldflags "-s -w -X main.defaultServer=https://425.today" \
|
|
||||||
-o ../dist/ody-agent-linux .
|
|
||||||
ls -lh ../dist/
|
|
||||||
|
|
||||||
- name: Create release and upload assets
|
|
||||||
run: |
|
|
||||||
VERSION="${{ steps.version.outputs.VERSION }}"
|
|
||||||
echo "Publishing release $VERSION"
|
|
||||||
|
|
||||||
# Create the release (may already exist from manual tag push)
|
|
||||||
RELEASE=$(curl -sf -X POST "https://git.wellspr.ing/api/v1/repos/wellspring/ody-agent/releases" \
|
|
||||||
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"tag_name\":\"$VERSION\",\"name\":\"Ody Agent $VERSION\",\"body\":\"### Ody Agent $VERSION\n\nDesktop agent for WellSpr.ing / NNN.today merchants.\n\n| Platform | File |\n|---|---|\n| Windows | \`ody-agent-win.exe\` |\n| macOS Apple Silicon | \`ody-agent-mac-arm64\` |\n| macOS Intel | \`ody-agent-mac-amd64\` |\n| Linux | \`ody-agent-linux\` |\",\"draft\":false,\"prerelease\":false}" \
|
|
||||||
|| curl -sf "https://git.wellspr.ing/api/v1/repos/wellspring/ody-agent/releases/tags/$VERSION" \
|
|
||||||
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}")
|
|
||||||
|
|
||||||
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
|
||||||
echo "Release ID: $RELEASE_ID"
|
|
||||||
|
|
||||||
for f in dist/*; do
|
|
||||||
FNAME=$(basename "$f")
|
|
||||||
echo "Uploading $FNAME..."
|
|
||||||
curl -sf -X POST \
|
|
||||||
"https://git.wellspr.ing/api/v1/repos/wellspring/ody-agent/releases/$RELEASE_ID/assets?name=$FNAME" \
|
|
||||||
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/octet-stream" \
|
|
||||||
--data-binary "@$f"
|
|
||||||
echo " uploaded."
|
|
||||||
done
|
|
||||||
echo "Release complete: https://git.wellspr.ing/wellspring/ody-agent/releases/tag/$VERSION"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue