Compare commits

...

14 commits

Author SHA1 Message Date
X9 Dev
58f1633d78 ci: trigger build (golang 1.24 runner active) 2026-04-16 12:00:15 +02:00
X9 Dev
3bba40e6d0 ci: trigger build with go 1.24 runner
Some checks failed
release / build-and-release (push) Failing after 3s
2026-04-16 11:56:46 +02:00
X9 Dev
d6fa73be56 ci: use sh shell (alpine has no bash)
Some checks failed
release / build-and-release (push) Failing after 3s
2026-04-16 11:56:17 +02:00
X9 Dev
2df894006f ci: fix working-directory and use internal Forgejo URL for git clone
Some checks failed
release / build-and-release (push) Failing after 1s
2026-04-16 11:56:01 +02:00
X9 Dev
bc9184345d ci: trigger build with fixed runner config
Some checks failed
release / build-and-release (push) Failing after 1s
2026-04-16 11:55:17 +02:00
X9 Dev
50b93a1a88 ci: add runner config with xetup network and debug logging 2026-04-16 11:50:51 +02:00
X9 Dev
5d0c73b514 ci: add workflow file itself to trigger paths
Some checks failed
release / build-and-release (push) Failing after 2s
2026-04-16 11:49:47 +02:00
X9 Dev
76eb7dd8d7 ci: remove redundant container directive, runner label handles it 2026-04-16 11:47:15 +02:00
X9 Dev
0a99e08142 ci: force workflow trigger
Some checks failed
release / build-and-release (push) Failing after 3s
2026-04-16 11:43:48 +02:00
X9 Dev
528dba0e38 ci: remove redundant setup-go, golang container has it pre-installed 2026-04-16 11:43:23 +02:00
X9 Dev
d22f81a3eb ci: trigger release build 2026-04-16 11:42:17 +02:00
X9 Dev
d05835c931 Fix runner: add daemon entrypoint and docker socket permissions
Some checks failed
release / build-and-release (push) Failing after 18s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 11:40:36 +02:00
X9 Dev
9a4afbf913 Add CI/CD: auto-build and publish xetup.exe on push to main
- .forgejo/workflows/release.yml: builds Windows exe on Go/script changes,
  deletes and recreates floating 'latest' release with new asset
- web/nginx.conf: /dl now points to .../download/latest/xetup.exe permanently
- runner.go: fix embed.FS path separator (filepath -> path) for Windows compat

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 11:37:17 +02:00
X9 Dev
f72b4bd190 Fix embed.FS path separator on Windows
Use path.Join (always '/') for embed.FS reads, filepath.Join only for OS paths.
filepath.Join on Windows produces backslashes which embed.FS doesn't accept,
causing "failed to extract scripts" on startup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 11:33:57 +02:00
7 changed files with 108 additions and 6 deletions

View file

@ -0,0 +1,74 @@
name: release
on:
push:
branches: [main]
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- 'scripts/**'
- 'assets/**'
- 'embed.go'
- '.forgejo/workflows/release.yml'
jobs:
build-and-release:
# Runner label 'ubuntu-latest' maps to golang:1.23-alpine container (see runner config)
runs-on: ubuntu-latest
defaults:
run:
shell: sh
working-directory: /repo
steps:
- name: Setup
working-directory: /
run: |
apk add --no-cache git curl jq
git clone --depth=1 \
"http://x9:${{ secrets.FORGEJO_TOKEN }}@xetup-forgejo:3000/${{ github.repository }}.git" \
/repo
cd /repo
git checkout "${{ github.sha }}"
- name: Build xetup.exe
run: |
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o xetup.exe ./cmd/xetup/
echo "Built: $(ls -lh xetup.exe | awk '{print $5}')"
- name: Publish latest release
env:
TOKEN: ${{ secrets.FORGEJO_TOKEN }}
API: http://xetup-forgejo:3000/api/v1
REPO: ${{ github.repository }}
run: |
SHORT=$(echo "${{ github.sha }}" | cut -c1-7)
# Delete existing 'latest' release and tag to recreate cleanly
RID=$(curl -sf -H "Authorization: token $TOKEN" \
"$API/repos/$REPO/releases/tags/latest" | jq -r '.id // empty')
if [ -n "$RID" ]; then
curl -sf -X DELETE -H "Authorization: token $TOKEN" \
"$API/repos/$REPO/releases/$RID" || true
fi
curl -sf -X DELETE -H "Authorization: token $TOKEN" \
"$API/repos/$REPO/tags/latest" || true
# Create new 'latest' release
RID=$(curl -sf -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
"$API/repos/$REPO/releases" \
-d "{\"tag_name\":\"latest\",\"name\":\"latest\",\"body\":\"Auto-built from ${SHORT}\",\"prerelease\":true}" \
| jq -r '.id')
# Upload xetup.exe
curl -sf -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/octet-stream" \
"$API/repos/$REPO/releases/$RID/assets?name=xetup.exe" \
--data-binary @xetup.exe
echo "Released xetup.exe (commit ${SHORT})"

View file

@ -67,3 +67,4 @@ func main() {
log.Fatalf("TUI error: %v", err)
}
}
// build 1776332628

View file

@ -38,6 +38,8 @@ services:
image: code.forgejo.org/forgejo/runner:6.3.1
container_name: xetup-runner
restart: unless-stopped
entrypoint: ["/bin/sh", "-c", "forgejo-runner daemon --config /etc/runner/config.yml"]
user: "0:996" # root:docker - needed for /var/run/docker.sock access
depends_on:
- forgejo
environment:
@ -45,6 +47,7 @@ services:
volumes:
- runner-data:/data
- /var/run/docker.sock:/var/run/docker.sock
- ./runner-config.yml:/etc/runner/config.yml:ro
networks:
- xetup

View file

@ -8,6 +8,7 @@ import (
"fmt"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"time"
@ -277,7 +278,8 @@ func ExtractScripts(fs interface{ ReadDir(string) ([]os.DirEntry, error); ReadFi
if e.IsDir() {
continue
}
data, err := fs.ReadFile(filepath.Join("scripts", e.Name()))
// embed.FS always uses forward slashes regardless of OS
data, err := fs.ReadFile(path.Join("scripts", e.Name()))
if err != nil {
return err
}
@ -298,13 +300,14 @@ func extractDir(fs interface{ ReadDir(string) ([]os.DirEntry, error); ReadFile(s
if err != nil {
return err
}
dst := filepath.Join(dstBase, src)
dst := filepath.Join(dstBase, filepath.FromSlash(src))
if err := os.MkdirAll(dst, 0755); err != nil {
return err
}
for _, e := range entries {
srcPath := filepath.Join(src, e.Name())
dstPath := filepath.Join(dstBase, srcPath)
// embed.FS always uses forward slashes regardless of OS
srcPath := path.Join(src, e.Name())
dstPath := filepath.Join(dstBase, filepath.FromSlash(srcPath))
if e.IsDir() {
if err := extractDir(fs, srcPath, dstBase); err != nil {
return err

21
runner-config.yml Normal file
View file

@ -0,0 +1,21 @@
log:
level: debug
runner:
file: /data/.runner
capacity: 1
timeout: 3h
fetch_timeout: 5s
fetch_interval: 2s
report_interval: 1s
cache:
enabled: true
container:
network: xetup
privileged: false
valid_volumes:
- '**'
docker_host: "-"
force_pull: false

View file

@ -14,9 +14,9 @@ server {
add_header X-Content-Type-Options nosniff always;
}
# Permanent shortlink to latest xetup.exe update on each release
# Permanent shortlink to latest xetup.exe never needs updating
location = /dl {
return 302 https://git.xetup.x9.cz/x9/xetup/releases/download/v0.1.0/xetup.exe;
return 302 https://git.xetup.x9.cz/x9/xetup/releases/download/latest/xetup.exe;
}
# Proxy Forgejo API calls so browser doesn't need CORS or direct access to Forgejo

BIN
xetup.exe

Binary file not shown.