-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (78 loc) · 2.4 KB
/
ci.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: firmware-syncer CI
on:
push:
branches:
- '*'
tags:
- 'v*.*.*'
- 'v*.*.*-staging'
pull_request:
branches:
- '*'
jobs:
lint-test-build-artifacts:
name: 🏗️ Lint, test and build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: '1.19'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git config --global url."https://${TOKEN}:x-oauth-basic@github.com".insteadOf "https://github.com/equinixmetal"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.48.0
args: --config .golangci.yml --timeout=5m
- name: Run firmware-syncer tests
run: make test
- name: Build firmware-syncer executable
run: make build-linux
- uses: actions/upload-artifact@v3
if: ( contains(github.ref, 'tags') && ! contains(github.ref, 'staging') )
with:
name: firmware-syncer-artifacts
path: |
firmware-syncer
firmware-syncer_checksum.txt
publish-executables:
name: 📦 Publish firmware-syncer executable
runs-on: ubuntu-latest
if: ( contains(github.ref, 'tags') && ! contains(github.ref, 'staging') )
needs: lint-test-build-artifacts
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: '1.19'
id: go
- name: Set git token env var
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git config --global url."https://${TOKEN}:x-oauth-basic@github.com".insteadOf "https://github.com/equinixmetal"
- uses: actions/download-artifact@v3
with:
name: firmware-syncer-artifacts
- name: Create a new release
id: create_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
- name: release artifact files
uses: softprops/action-gh-release@v1
if: contains(github.ref, 'tags')
with:
files: |
firmware-syncer
firmware-syncer_checksum.txt