From 6737add91e8ecd28780711c591b018ab5d8d603f Mon Sep 17 00:00:00 2001 From: Finessse Date: Tue, 30 Dec 2025 01:27:25 +0700 Subject: [PATCH] ci: add proxypilot npm release workflows --- .github/workflows/proxypilot-bun.yml | 31 ++++++++ .github/workflows/proxypilot-npm-release.yml | 80 ++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 .github/workflows/proxypilot-bun.yml create mode 100644 .github/workflows/proxypilot-npm-release.yml diff --git a/.github/workflows/proxypilot-bun.yml b/.github/workflows/proxypilot-bun.yml new file mode 100644 index 00000000..dfa9a976 --- /dev/null +++ b/.github/workflows/proxypilot-bun.yml @@ -0,0 +1,31 @@ +name: Publish ProxyPilot via Bun + +on: + workflow_run: + workflows: ["ProxyPilot NPM Release"] + types: + - completed + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Setup registry auth + working-directory: bun/proxypilot + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc + + - name: Publish package + working-directory: bun/proxypilot + run: bun publish --access public + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/proxypilot-npm-release.yml b/.github/workflows/proxypilot-npm-release.yml new file mode 100644 index 00000000..b7a761ba --- /dev/null +++ b/.github/workflows/proxypilot-npm-release.yml @@ -0,0 +1,80 @@ +name: ProxyPilot NPM Release + +on: + push: + tags: + - 'npm-v*' + +permissions: + contents: write + +jobs: + build: + name: Build ${{ matrix.os }}-${{ matrix.arch }} + runs-on: ubuntu-latest + strategy: + matrix: + include: + - os: darwin + arch: amd64 + extension: '' + - os: darwin + arch: arm64 + extension: '' + - os: linux + arch: amd64 + extension: '' + - os: linux + arch: arm64 + extension: '' + - os: windows + arch: amd64 + extension: '.exe' + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.21' + + - name: Build binary + env: + GOOS: ${{ matrix.os }} + GOARCH: ${{ matrix.arch }} + CGO_ENABLED: 0 + run: | + go build -ldflags="-s -w" -o proxypilot-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }} ./cmd/server + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: proxypilot-${{ matrix.os }}-${{ matrix.arch }} + path: proxypilot-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }} + + release: + name: Create Release + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Prepare release assets + run: | + mkdir -p release + find artifacts -type f -exec cp {} release/ \; + ls -la release/ + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: release/* + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}