fix(keypool): sticky 按完整会话键散列,会话级负载均衡 #61
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version, for example v0.1.0" | |
| required: true | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| metadata: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Resolve version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| version="${{ inputs.version }}" | |
| else | |
| version="${GITHUB_REF_NAME}" | |
| fi | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| verify: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.22.x" | |
| cache: false | |
| - name: Verify | |
| run: | | |
| gofmt -l . | tee /tmp/gofmt.txt | |
| test ! -s /tmp/gofmt.txt | |
| go test ./... | |
| go vet ./... | |
| build: | |
| name: Build ${{ matrix.asset }} | |
| needs: | |
| - metadata | |
| - verify | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: linux/amd64 | |
| asset: linux_amd64 | |
| - target: linux/arm64 | |
| asset: linux_arm64 | |
| - target: linux/arm/v7 | |
| asset: linux_arm_v7 | |
| - target: darwin/amd64 | |
| asset: darwin_amd64 | |
| - target: darwin/arm64 | |
| asset: darwin_arm64 | |
| - target: windows/amd64 | |
| asset: windows_amd64 | |
| - target: windows/arm64 | |
| asset: windows_arm64 | |
| - target: freebsd/amd64 | |
| asset: freebsd_amd64 | |
| - target: freebsd/arm64 | |
| asset: freebsd_arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.22.x" | |
| cache: false | |
| - name: Build target | |
| env: | |
| TARGETS: ${{ matrix.target }} | |
| CHECKSUMS: "false" | |
| VERSION: ${{ needs.metadata.outputs.version }} | |
| COMMIT: ${{ github.sha }} | |
| run: ./scripts/build-release.sh | |
| - name: Upload target artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: opencode2api-${{ needs.metadata.outputs.version }}-${{ matrix.asset }} | |
| path: dist/*.tar.gz | |
| if-no-files-found: error | |
| publish: | |
| name: Publish GitHub Release | |
| needs: | |
| - metadata | |
| - build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download target artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Generate checksums | |
| run: | | |
| cd dist | |
| sha256sum ./*.tar.gz > checksums.txt | |
| ls -lh | |
| - name: Publish GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| VERSION: ${{ needs.metadata.outputs.version }} | |
| run: | | |
| if gh release view "$VERSION" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then | |
| gh release upload "$VERSION" dist/* --repo "$GITHUB_REPOSITORY" --clobber | |
| else | |
| gh release create "$VERSION" dist/* \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --title "opencode2api $VERSION" \ | |
| --target "$GITHUB_SHA" \ | |
| --generate-notes | |
| fi |