-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (104 loc) · 2.68 KB
/
release.yaml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
---
name: Release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- '*.go'
- go.mod
- go.sum
pull_request:
paths:
- '*.go'
- go.mod
- go.sum
- .github/workflows/*.yaml
jobs:
gotest:
name: Go test
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Test
run: go test -v ./...
# e2e:
# name: End to end test
# runs-on: ubuntu-20.04
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version: 1.21
#
# - name: Install mosquitto
# run: sudo apt-get install -y mosquitto mosquitto-clients
#
# - name: Run mosquitto
# run: |
# mosquitto -c ${{ github.workspace }}/.github/workflows/mosquitto_config/mosquitto.conf &
# sleep 2
#
# - name: Run module
# run: |
# go run . &
# sleep 5
# env:
# GOWON_XBOXLIVE_API_KEY: abc
#
# - name: Run end to end testing
# run: ./e2e.sh
build:
name: Build
runs-on: ubuntu-22.04
needs:
- gotest
# - e2e
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Prepare
id: prep
run: |
if [ "${{github.event_name}}" == "pull_request" ]; then
echo ::set-output name=PUSH::false
else
echo ::set-output name=PUSH::true
fi
echo ::set-output name=GITVERSIONF::${GITVERSION_FULLSEMVER/+/-}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Setup ko
uses: imjasonh/[email protected]
- name: Build local image
run: >
ko build --bare --platform linux/amd64,linux/arm64
--sbom none --tags latest,${{ steps.prep.outputs.GITVERSIONF }} --push=false .
if: ${{ steps.prep.outputs.PUSH == 'false' }}
- name: Build and push image
run: >
ko build --bare --platform linux/amd64,linux/arm64
--sbom none --tags latest,${{ steps.prep.outputs.GITVERSIONF }} .
if: ${{ steps.prep.outputs.PUSH == 'true' }}