diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3edf5cf..e96216e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,6 @@ on: jobs: # ── 1. 정적 분석 + 빌드 + 테스트 ────────────────────────────────────────── test: - # Win32 API 의존성으로 Windows runner 필수 runs-on: windows-latest steps: - uses: actions/checkout@v4 @@ -29,13 +28,11 @@ jobs: - name: Test run: go test ./... -v - # ── 2. 릴리즈 빌드 & GitHub Release 업로드 (태그 push 시만) ─────────────── + # ── 2. Gitea Release 생성 + launcher.exe 업로드 (태그 push 시만) ────────── release: needs: test if: startsWith(github.ref, 'refs/tags/v') runs-on: windows-latest - permissions: - contents: write steps: - uses: actions/checkout@v4 @@ -46,11 +43,43 @@ jobs: - name: Build release binary run: | - $VERSION = "${{ github.ref_name }}" - go build -ldflags="-H windowsgui -s -w -X main.version=$VERSION" -o launcher.exe . + $version = "${{ github.ref_name }}" + go build -ldflags="-H windowsgui -s -w -X main.version=$version" -o launcher.exe . - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - files: launcher.exe - generate_release_notes: true + - name: Create Gitea release & upload launcher.exe + shell: pwsh + run: | + $version = "${{ github.ref_name }}" + $repo = "${{ github.repository }}" + $token = "${{ secrets.GITEA_TOKEN }}" + $baseUrl = "https://git.tolelom.xyz/api/v1" + + $headers = @{ + "Authorization" = "token $token" + "Content-Type" = "application/json" + } + + # 릴리즈 생성 + $body = @{ + tag_name = $version + name = $version + body = "Release $version" + } | ConvertTo-Json -Compress + + $release = Invoke-RestMethod ` + -Uri "$baseUrl/repos/$repo/releases" ` + -Method Post ` + -Headers $headers ` + -Body $body + + # launcher.exe 업로드 + $uploadHeaders = @{ + "Authorization" = "token $token" + "Content-Type" = "application/octet-stream" + } + $fileBytes = [System.IO.File]::ReadAllBytes("${{ github.workspace }}\launcher.exe") + Invoke-RestMethod ` + -Uri "$baseUrl/repos/$repo/releases/$($release.id)/assets?name=launcher.exe" ` + -Method Post ` + -Headers $uploadHeaders ` + -Body $fileBytes