Add core modules (SSH args parser, cache, resolver, NetBox client) with tests
Release / release (push) Failing after 51s

This commit is contained in:
Sebastian Unterschütz
2026-05-23 12:38:41 +02:00
commit 8ef4bbec16
24 changed files with 2524 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run tests
run: go test ./...
- name: Build binaries
run: |
mkdir -p dist
for platform in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64; do
GOOS=${platform%/*}
GOARCH=${platform#*/}
out="dist/netssh_${GOOS}_${GOARCH}"
echo "→ $out"
CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH \
go build -trimpath -ldflags="-s -w" \
-o "$out" ./cmd/netssh
done
- name: Generate checksums
working-directory: dist
run: sha256sum netssh_* > checksums.txt
- name: Create release
id: create_release
run: |
TAG="${{ github.ref_name }}"
RELEASE=$(curl -sf -X POST \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/json" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" \
-d "{
\"tag_name\": \"$TAG\",
\"name\": \"$TAG\",
\"body\": \"## Installation\n\n\`\`\`sh\ncurl -fsSL https://git.zb-server.de/Sebi/ssh-netbox-wrapper/raw/branch/main/install.sh | bash\n\`\`\`\",
\"draft\": false,
\"prerelease\": false
}")
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
echo "release_id=$RELEASE_ID" >> "$GITHUB_OUTPUT"
- name: Upload assets
run: |
RELEASE_ID="${{ steps.create_release.outputs.release_id }}"
for file in dist/netssh_* dist/checksums.txt; do
name=$(basename "$file")
echo "↑ $name"
curl -sf -X POST \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets?name=${name}" \
--data-binary "@$file"
done