137 lines
3.9 KiB
YAML
137 lines
3.9 KiB
YAML
name: Go releaser
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
- "*.*.*-rc*"
|
|
- "*.*.*-beta*"
|
|
- "*.*.*-alpha*"
|
|
- "*.*.*-dev*"
|
|
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
goreleaser:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Ignore prerelease tags
|
|
if: "!contains(github.ref_name, '-')"
|
|
run: |
|
|
git tag -l | grep -E '\-dev|\-rc|\-beta|\-alpha' | xargs -r git tag -d
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: ./go.mod
|
|
- name: Run goreleaser
|
|
uses: goreleaser/goreleaser-action@v7
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
distribution: goreleaser
|
|
args: release --clean
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: binary
|
|
path: dist/yutu_*/yutu-*
|
|
|
|
attestation:
|
|
needs: [ goreleaser ]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
attestations: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
path:
|
|
- darwin_amd64_v1/yutu-darwin-amd64
|
|
- darwin_arm64_v8.0/yutu-darwin-arm64
|
|
- linux_amd64_v1/yutu-linux-amd64
|
|
- linux_arm64_v8.0/yutu-linux-arm64
|
|
- windows_amd64_v1/yutu-windows-amd64.exe
|
|
- windows_arm64_v8.0/yutu-windows-arm64.exe
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: binary
|
|
- name: Attest
|
|
uses: actions/attest@v4
|
|
with:
|
|
subject-path: "${{ github.workspace }}/yutu_${{ matrix.path }}"
|
|
|
|
winget:
|
|
needs: [ goreleaser ]
|
|
runs-on: windows-latest
|
|
if: |
|
|
startsWith(github.ref, 'refs/tags/') &&
|
|
!contains(github.ref, '-rc') &&
|
|
!contains(github.ref, '-beta') &&
|
|
!contains(github.ref, '-alpha') &&
|
|
!contains(github.ref, '-dev')
|
|
steps:
|
|
- uses: vedantmgoyal9/winget-releaser@main
|
|
with:
|
|
identifier: eat-pray-ai.yutu
|
|
installers-regex: '\.exe$' # Only .exe files
|
|
token: ${{ secrets.RELEASE_PAT }}
|
|
max-versions-to-keep: 3
|
|
|
|
github-registry:
|
|
needs: [ goreleaser ]
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
attestations: write
|
|
id-token: write
|
|
steps:
|
|
- uses: eat-pray-ai/yutu/.github/actions/github-registry@main
|
|
with:
|
|
arm64_binary: yutu_linux_arm64_v8.0/yutu-linux-arm64
|
|
amd64_binary: yutu_linux_amd64_v1/yutu-linux-amd64
|
|
|
|
npm:
|
|
needs: [ goreleaser ]
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
sparse-checkout: |
|
|
npm
|
|
scripts/npm-publish.sh
|
|
server.json
|
|
LICENSE
|
|
README.md
|
|
sparse-checkout-cone-mode: false
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: "24"
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: binary
|
|
path: ${{ github.workspace }}/dist
|
|
- name: Publish to npm
|
|
run: |
|
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
scripts/npm-publish.sh "$VERSION" "${{ github.workspace }}/dist"
|
|
- name: Publish MCP server
|
|
run: |
|
|
sed -i "s/0.0.0-dev/${GITHUB_REF_NAME#v}/g" server.json
|
|
mcp_publisher="mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz"
|
|
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/${mcp_publisher}" | tar xz mcp-publisher
|
|
./mcp-publisher login github-oidc
|
|
./mcp-publisher publish || echo "Failed to publish MCP server"
|