Skip to content

Commit

Permalink
feat: ci for cli auto publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeuoly committed Nov 7, 2024
1 parent e5ba990 commit c087652
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/publish-cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Publish CLI

on:
release:
types: [published]

concurrency:
group: publish-cli-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.platform == 'linux/arm64' && 'arm64_runner' || 'ubuntu-latest' }}
if: github.repository == 'langgenius/dify-plugin-daemon'
strategy:
matrix:
include:
- platform: linux/amd64
- platform: linux/arm64
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Transform platform
run: |
PLATFORM_TRANSFORMED=$(echo "${{ matrix.platform }}" | tr '/' '-')
echo "PLATFORM_TRANSFORMED=$PLATFORM_TRANSFORMED" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.x

- name: Build CLI
run: |
go mod tidy
go build -o dify-plugin-${{ env.PLATFORM_TRANSFORMED }} ./cmd/commandline
- name: Publish CLI
run: |
gh release upload ${{ github.event.release.tag_name }} dify-plugin-${{ env.PLATFORM_TRANSFORMED }} --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c087652

Please sign in to comment.