summaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: dddf21ae38e161939ad47141e3f8b0be3781450d (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Go

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    name: Build
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-2022]
    env:
      GOARCH: amd64
    steps:
      - name: Set up Go 1.17
        uses: actions/setup-go@v2
        with:
          go-version: 1.17
        id: go

      - id: go-cache-paths
        run: |
            echo "::set-output name=go-build::$(go env GOCACHE)"
            echo "::set-output name=go-mod::$(go env GOMODCACHE)"

      - if: startsWith(matrix.os,'ubuntu')
        name: Install Dependencies
        run: |
              sudo apt-get --allow-releaseinfo-change update
              sudo apt-get install -y libglfw3-dev libfreetype6-dev

      - name: Go Build Cache
        uses: actions/cache@v2
        with:
          path: ${{ steps.go-cache-paths.outputs.go-build }}
          key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

      - name: Go Mod Cache
        uses: actions/cache@v2
        with:
          path: ${{ steps.go-cache-paths.outputs.go-mod }}
          key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

      - name: Checkout
        uses: actions/checkout@v2

      - name: Get dependencies
        run: go get -v -t -d ./...

      - name: Build
        run: go build -v ./...

      - name: Test
        run: go test -v ./...

      - name: Vet
        run: go vet ./...

      - name: Release Build
        run: go build -ldflags '-s -w -H=windowsgui'

      - name: Upload Release
        uses: ColinPitrat/update-release@v1.0.1
        id: update-release
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          files: bin/*
          tag: release