Skip to content

Merge branch 'main' into feature-support-resource-event-pod-service #895

Merge branch 'main' into feature-support-resource-event-pod-service

Merge branch 'main' into feature-support-resource-event-pod-service #895

Workflow file for this run

name: build cli
on:
push:
branches:
- main
- v6.[1-9]
- v7.[1-9]
- 'feature-**'
paths:
- 'cli/**'
tags:
- '*'
workflow_dispatch:
inputs:
ref:
description: "Why trigger?"
required: true
type: string
jobs:
build_cli:
name: build cli
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@master
with:
go-version: 1.20.x
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: '3.6.1'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: build cli
run: |
sudo apt-get install tmpl
pip install ujson
GO111MODULE="off" go get github.com/gogo/protobuf/protoc-gen-gofast
GO111MODULE="off" go get github.com/gogo/protobuf/proto
GO111MODULE="off" go get github.com/gogo/protobuf/jsonpb
GO111MODULE="off" go get github.com/gogo/protobuf/protoc-gen-gogo
GO111MODULE="off" go get github.com/gogo/protobuf/gogoproto
GO111MODULE="off" go get github.com/golang/protobuf/protoc-gen-go
GO111MODULE="off" go get golang.org/x/tools/cmd/stringer
cd cli
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make -e BINARY_SUFFIX=.linux-amd64 -e BRANCH=${{ github.ref_name }}
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 make -e BINARY_SUFFIX=.linux-arm64 -e BRANCH=${{ github.ref_name }}
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 make -e BINARY_SUFFIX=.darwin-amd64 -e BRANCH=${{ github.ref_name }}
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 make -e BINARY_SUFFIX=.darwin-arm64 -e BRANCH=${{ github.ref_name }}
cd bin/
sha256sum * > deepflow-agent.sha256sum.txt
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: deepflow-cli
path: ./cli/bin/*
- uses: manyuanrong/setup-ossutil@v2.0
with:
endpoint: "oss-accelerate.aliyuncs.com"
access-key-id: "${{ secrets.ALIYUN_OSS_ACCESS_KEY }}"
access-key-secret: "${{ secrets.ALIYUN_OSS_SECRETS_KEY }}"
- name: set env
run: |
echo "IMAGE_TAG_PREFIX=${{ github.ref_name }}"|sed 's|=main$|=latest|' >> $GITHUB_ENV
echo "IMAGE_TAG=$(git rev-list --count HEAD)" >> $GITHUB_ENV
- name: upload cli
run: |
ossutil cp -rf cli/bin/deepflow-ctl.linux-amd64 oss://deepflow-ce/bin/ctl/${{ env.IMAGE_TAG_PREFIX }}/linux/amd64/deepflow-ctl
ossutil cp -rf cli/bin/deepflow-ctl.linux-arm64 oss://deepflow-ce/bin/ctl/${{ env.IMAGE_TAG_PREFIX }}/linux/arm64/deepflow-ctl
ossutil cp -rf cli/bin/deepflow-ctl.darwin-amd64 oss://deepflow-ce/bin/ctl/${{ env.IMAGE_TAG_PREFIX }}/darwin/amd64/deepflow-ctl
ossutil cp -rf cli/bin/deepflow-ctl.darwin-arm64 oss://deepflow-ce/bin/ctl/${{ env.IMAGE_TAG_PREFIX }}/darwin/arm64/deepflow-ctl
- name: upload cli stable artifacts
if: "startsWith(github.ref, 'refs/tags/')"
run: |
ossutil cp -rf cli/bin/deepflow-ctl.linux-amd64 oss://deepflow-ce/bin/ctl/stable/linux/amd64/deepflow-ctl
ossutil cp -rf cli/bin/deepflow-ctl.linux-arm64 oss://deepflow-ce/bin/ctl/stable/linux/arm64/deepflow-ctl
ossutil cp -rf cli/bin/deepflow-ctl.darwin-amd64 oss://deepflow-ce/bin/ctl/stable/darwin/amd64/deepflow-ctl
ossutil cp -rf cli/bin/deepflow-ctl.darwin-arm64 oss://deepflow-ce/bin/ctl/stable/darwin/arm64/deepflow-ctl
# - name: Prepare for upload package
# shell: bash
# run: |
# sha256sum dist/* > deepflow-agent.sha256sum.txt
# - name: Release and upload packages
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# files: |
# deepflow-agent.sha256sum.txt
# dist/*