forked from formancehq/ledger
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (102 loc) · 3.16 KB
/
main.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
on:
push:
branches:
- main
name: Main
jobs:
docs:
name: 'Build Docs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- run: |
wget https://github.com/swaggo/swag/releases/download/v1.7.4/swag_1.7.4_Linux_x86_64.tar.gz
tar -zxvf swag_1.7.4_Linux_x86_64.tar.gz
- run: ./swag init
- uses: actions/upload-artifact@v2
with:
name: docs-dist
path: ./docs/**
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[skip ci] Update docs"
file_pattern: docs/docs.go docs/*.go
build_control:
name: 'Build Control'
runs-on: ubuntu-latest
steps:
- name: Get latest release of Numary/Control
uses: rez0n/actions-github-release@main
id: control_release
env:
token: ${{ secrets.GITHUB_TOKEN }}
repository: "numary/control"
type: "stable"
- run: curl -OL ${{ steps.control_release.outputs.browser_download_url }}
- run: tar -zxvf numary-control-${{ steps.control_release.outputs.release }}.tar.gz
- run: rm -rf numary-control-${{ steps.control_release.outputs.release }}.tar.gz
- uses: actions/upload-artifact@v2
with:
name: control-dist
path: ./**
build:
name: 'Build'
needs:
- build_control
- docs
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
include:
- os: windows-latest
file: windows
- os: ubuntu-latest
file: default
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.16'
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: get deps
run: go get
env:
CGO_ENABLED: 1
- name: fetch numary control
uses: actions/download-artifact@v2
with:
name: control-dist
path: cmd/control/
- name: fetch docs
uses: actions/download-artifact@v2
with:
name: docs-dist
path: docs/
- name: OSXCross for CGO Support
if: matrix.os == 'ubuntu-latest'
run: |
mkdir ../../osxcross
git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target
- name: Downgrade libssl
if: matrix.os == 'ubuntu-latest'
run: |
echo 'deb http://security.ubuntu.com/ubuntu bionic-security main' | sudo tee -a /etc/apt/sources.list
sudo apt update && apt-cache policy libssl1.0-dev
sudo apt-get install libssl1.0-dev
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: build --parallelism 4 --rm-dist --skip-validate --snapshot --config .github/.goreleaser.${{matrix.file}}.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}