summaryrefslogtreecommitdiffstats
path: root/.github/workflows/build.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/build.yml')
-rw-r--r--.github/workflows/build.yml55
1 files changed, 55 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..51e06d0
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,55 @@
+name: Build gotop with NVidia extension
+
+on:
+ repository_dispatch:
+ types: [my-release]
+
+env:
+ VERSION: ${{ github.event.client_payload.tag }}
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Install Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: 1.14.3
+
+ - name: Get tag name
+ shell: bash
+ run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF##*/})"
+ id: tag_name
+
+ - name: Get builder
+ shell: bash
+ run: curl -O https://raw.githubusercontent.com/xxxserxxx/gotop-builder/master/build.go
+
+ - name: Generate gotop.go
+ shell: bash
+ run: go run ./build.go -r ${VERSION} github.com/xxxserxxx/gotop-nvidia
+ env:
+ VERSION: ${{ github.event.client_payload.tag }}
+
+ - name: Compile
+ shell: bash
+ run: go build -o gotop -ldflags "-extldflags '-static' -X main.Version=${VERSION}+nvidia:${NVIDIA} -X main.BuildDate=$(date +%Y%m%dT%H%M%s)" ./gotop.go
+ env:
+ VERSION: ${{ github.event.client_payload.tag }}
+ NVIDIA: ${{ steps.tag_name.outputs.tag }}
+
+ - name: Compress
+ shell: bash
+ run: xz gotop
+
+ - name: Pre-release
+ uses: "marvinpinto/action-automatic-releases@latest"
+ with:
+ repo_token: "${{ secrets.GITHUB_TOKEN }}"
+ automatic_release_tag: "${VERSION}+nvidia:${NVIDIA}"
+ draft: false
+ title: "${VERSION} Linux amd64 with NVidia ${NVIDIA} extension"
+ files: gotop.xz
+ env:
+ VERSION: ${{ github.event.client_payload.tag }}
+ NVIDIA: ${{ steps.tag_name.outputs.tag }}