67 lines
2.5 KiB
YAML
67 lines
2.5 KiB
YAML
name: Release plugin package
|
|
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
package:
|
|
runs-on: ubuntu-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
|
|
shell: pwsh
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path 'reims-go/cmd/reims-doctor' | Out-Null
|
|
@'
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"github.com/Nwflower/reims-go/internal/cli"
|
|
)
|
|
|
|
func main() { os.Exit(cli.Main(os.Args[1:])) }
|
|
'@ | Set-Content -Encoding utf8 'reims-go/cmd/reims-doctor/main.go'
|
|
$env:CGO_ENABLED = '0'
|
|
go build -C reims-go -trimpath -o ../reims-go-plugin-cli.exe ./cmd/reims-doctor
|
|
- name: Validate and package plugin
|
|
id: package
|
|
shell: pwsh
|
|
run: |
|
|
$tag = '${{ github.ref_name }}'
|
|
$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 .
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
.\reims-go-plugin-cli.exe plugin pack --out "reims.agent-$version.zip" .
|
|
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"
|
|
"version=$version" | 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
|