summaryrefslogtreecommitdiffstats
path: root/.github/workflows/build.yml
blob: c6e16da75d63aa832ab72797a1bc3d973e96c822 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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: "${{ github.event.client_payload.tag }}+nvidia-${{ steps.tag_name.outputs.tag }}"
          draft: false
          title: "${{ github.event.client_payload.tag }} Linux amd64 with NVidia ${{ steps.tag_name.outputs.tag }} extension"
          files: gotop.xz