Skip to content

Commit

Permalink
enhancement: reduce github action runs for cli complation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeuoly committed Nov 7, 2024
1 parent 60a5a51 commit e9e3d8c
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/publish-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,14 @@ jobs:
matrix:
include:
- platform: linux/amd64
target: linux-amd64
- platform: linux/arm64
target: linux-arm64
- platform: linux/amd64
target: darwin-amd64
- platform: linux/arm64
target: darwin-arm64
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Transform platform
run: |
GOOS=$(echo "${{ matrix.target }}" | cut -d '-' -f 1)
echo "GOOS=$GOOS" >> $GITHUB_ENV
GOARCH=$(echo "${{ matrix.target }}" | cut -d '-' -f 2)
GOARCH=$(echo "${{ matrix.platform }}" | cut -d '/' -f 2)
echo "GOARCH=$GOARCH" >> $GITHUB_ENV
- name: Set up Go
Expand All @@ -42,10 +34,14 @@ jobs:
- name: Build CLI
run: |
go mod tidy
GOOS=${{ env.GOOS }} GOARCH=${{ env.GOARCH }} go build -o dify-plugin-${{ env.GOOS }}-${{ env.GOARCH }} ./cmd/commandline
GOOS=windows GOARCH=${{ env.GOARCH }} go build -o dify-plugin-windows-${{ env.GOARCH }} ./cmd/commandline
GOOS=darwin GOARCH=${{ env.GOARCH }} go build -o dify-plugin-darwin-${{ env.GOARCH }} ./cmd/commandline
GOOS=linux GOARCH=${{ env.GOARCH }} go build -o dify-plugin-linux-${{ env.GOARCH }} ./cmd/commandline
- name: Publish CLI
run: |
gh release upload ${{ github.event.release.tag_name }} dify-plugin-${{ env.GOOS }}-${{ env.GOARCH }} --clobber
gh release upload ${{ github.event.release.tag_name }} dify-plugin-windows-${{ env.GOARCH }} --clobber
gh release upload ${{ github.event.release.tag_name }} dify-plugin-darwin-${{ env.GOARCH }} --clobber
gh release upload ${{ github.event.release.tag_name }} dify-plugin-linux-${{ env.GOARCH }} --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit e9e3d8c

Please sign in to comment.