-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (72 loc) · 2.09 KB
/
go.yml
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
name: Go
on:
push:
tags: ["v*"]
jobs:
build:
strategy:
matrix:
arch: [linux_amd64, linux_arm, windows_amd64, darwin_amd64]
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22.5
uses: actions/setup-go@v1
with:
go-version: 1.22.5
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: build
run: |
go get -v -t -d ./...
go generate ./...
arch=${{matrix.arch}}
export GOOS=${arch%%_*} GOARCH=${arch##*_} GOARM=5
go build -o unifi2mqtt.$arch -v --ldflags="-s -X 'main.version=${{ github.ref }}'" .
- name: upload-artifact unifi2mqtt
uses: actions/upload-artifact@v1
with:
name: unifi2mqtt.${{matrix.arch}}
path: unifi2mqtt.${{matrix.arch}}
release:
name: Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- id: create_release
name: Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
assets:
name: Upload Assets
runs-on: ubuntu-latest
needs: release
strategy:
matrix:
arch: [linux_amd64, linux_arm, windows_amd64, darwin_amd64]
artifact: [unifi2mqtt]
steps:
- name: download ${{matrix.artifact}}.${{matrix.arch}}
uses: actions/download-artifact@v1
with:
name: ${{matrix.artifact}}.${{matrix.arch}}
path: ./
- name: upload ${{matrix.artifact}}.${{matrix.arch}} to release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{matrix.artifact}}.${{matrix.arch}}
asset_name: ${{matrix.artifact}}.${{matrix.arch}}
asset_content_type: application/octet-stream