ci(release): run on windows-latest and build plugin CLI outside workspace
Release plugin package / package (push) Canceled after 0s
Release plugin package / package (push) Canceled after 0s
This commit is contained in:
1 parent
98aea3bd14
commit
ce65fe386e
1 file changed
+36
-23
@@ -9,30 +9,34 @@ permissions:
|
||||
|
||||
jobs:
|
||||
package:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache-dependency-path: go.sum
|
||||
- name: Build Windows sidecar
|
||||
run: |
|
||||
mkdir -p bin
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o bin/reims-agent.exe ./cmd/reims-agent
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: Nwflower/Reims-Go
|
||||
ref: main
|
||||
path: reims-go
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: reims-go/go.mod
|
||||
cache-dependency-path: reims-go/go.sum
|
||||
- name: Build headless Reims-Go plugin CLI
|
||||
- name: Test and build Windows sidecar
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path 'reims-go/cmd/reims-doctor' | Out-Null
|
||||
go test ./...
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
go vet ./...
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
New-Item -ItemType Directory -Force -Path bin | Out-Null
|
||||
$env:GOOS = 'windows'
|
||||
$env:GOARCH = 'amd64'
|
||||
$env:CGO_ENABLED = '0'
|
||||
go build -trimpath -o bin/reims-agent.exe ./cmd/reims-agent
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
- name: Build headless Reims-Go plugin CLI outside workspace
|
||||
shell: pwsh
|
||||
run: |
|
||||
$cliRepo = Join-Path $env:RUNNER_TEMP 'reims-go'
|
||||
git clone --depth 1 --branch main https://github.com/Nwflower/Reims-Go.git $cliRepo
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
$doctorDir = Join-Path $cliRepo 'cmd/reims-doctor'
|
||||
New-Item -ItemType Directory -Force -Path $doctorDir | Out-Null
|
||||
@'
|
||||
package main
|
||||
|
||||
@@ -42,9 +46,11 @@ jobs:
|
||||
)
|
||||
|
||||
func main() { os.Exit(cli.Main(os.Args[1:])) }
|
||||
'@ | Set-Content -Encoding utf8 'reims-go/cmd/reims-doctor/main.go'
|
||||
'@ | Set-Content -Encoding utf8 (Join-Path $doctorDir 'main.go')
|
||||
$cliBin = Join-Path $env:RUNNER_TEMP 'reims-go-plugin-cli.exe'
|
||||
$env:CGO_ENABLED = '0'
|
||||
go build -C reims-go -trimpath -o ../reims-go-plugin-cli.exe ./cmd/reims-doctor
|
||||
go build -C $cliRepo -trimpath -o $cliBin ./cmd/reims-doctor
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
- name: Validate and package plugin
|
||||
id: package
|
||||
shell: pwsh
|
||||
@@ -53,14 +59,21 @@ jobs:
|
||||
$version = $tag.Substring(1)
|
||||
$manifest = Get-Content -Raw plugin.json | ConvertFrom-Json
|
||||
if ($manifest.version -ne $version) { throw "Tag $tag does not match plugin.json version $($manifest.version)" }
|
||||
.\reims-go-plugin-cli.exe plugin doctor .
|
||||
$cliBin = Join-Path $env:RUNNER_TEMP 'reims-go-plugin-cli.exe'
|
||||
$zipPath = Join-Path $env:RUNNER_TEMP "reims.agent-$version.zip"
|
||||
$shaPath = Join-Path $env:RUNNER_TEMP "reims.agent-$version.sha256"
|
||||
& $cliBin plugin doctor .
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
.\reims-go-plugin-cli.exe plugin pack --out "reims.agent-$version.zip" .
|
||||
& $cliBin plugin pack --out $zipPath .
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
$hash = (Get-FileHash "reims.agent-$version.zip" -Algorithm SHA256).Hash.ToLowerInvariant()
|
||||
"$hash reims.agent-$version.zip" | Set-Content -Encoding ascii "reims.agent-$version.sha256"
|
||||
$hash = (Get-FileHash $zipPath -Algorithm SHA256).Hash.ToLowerInvariant()
|
||||
"$hash reims.agent-$version.zip" | Set-Content -Encoding ascii $shaPath
|
||||
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
"zip_path=$zipPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
"sha_path=$shaPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
- name: Publish GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: gh release create "${{ github.ref_name }}" "reims.agent-${{ steps.package.outputs.version }}.zip" "reims.agent-${{ steps.package.outputs.version }}.sha256" --verify-tag --generate-notes
|
||||
shell: pwsh
|
||||
run: |
|
||||
gh release create "${{ github.ref_name }}" "${{ steps.package.outputs.zip_path }}" "${{ steps.package.outputs.sha_path }}" --verify-tag --generate-notes
|
||||
Reference in new issue
Block a user