2020-05-15 09:41:18 +00:00
|
|
|
# .github/workflows/build-docker-image.yml
|
2020-07-27 10:18:55 +00:00
|
|
|
name: build
|
2020-05-15 09:41:18 +00:00
|
|
|
|
2022-06-17 14:12:49 +00:00
|
|
|
on:
|
2020-05-15 09:41:18 +00:00
|
|
|
release:
|
2022-12-21 19:34:11 +00:00
|
|
|
types:
|
|
|
|
- prereleased
|
2020-05-15 09:41:18 +00:00
|
|
|
|
|
|
|
jobs:
|
2020-07-27 10:18:55 +00:00
|
|
|
build:
|
2023-02-28 16:25:09 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go-version: ["1.20.1"]
|
|
|
|
|
2020-05-15 09:41:18 +00:00
|
|
|
name: Build and upload binary package
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-02-28 16:25:09 +00:00
|
|
|
- name: "Set up Go ${{ matrix.go-version }}"
|
2022-12-21 19:34:11 +00:00
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
2023-02-28 16:25:09 +00:00
|
|
|
go-version: ${{ matrix.go-version }}
|
2022-12-21 19:34:11 +00:00
|
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v3
|
2023-01-13 13:16:17 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-02-28 16:25:09 +00:00
|
|
|
submodules: false
|
|
|
|
|
|
|
|
- name: Cache Go modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
~/.cache/go-build
|
|
|
|
~/Library/Caches/go-build
|
|
|
|
%LocalAppData%\go-build
|
|
|
|
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.go-version }}-go-
|
|
|
|
|
2022-12-21 19:34:11 +00:00
|
|
|
- name: Build the binaries
|
|
|
|
run: make release
|
|
|
|
- name: Upload to release
|
|
|
|
uses: JasonEtco/upload-to-release@master
|
|
|
|
with:
|
|
|
|
args: crowdsec-release.tgz application/x-gzip
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-02-28 16:25:09 +00:00
|
|
|
|
2021-04-07 08:14:39 +00:00
|
|
|
build_static:
|
2023-02-28 16:25:09 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go-version: ["1.20.1"]
|
2021-04-07 08:14:39 +00:00
|
|
|
name: Build and upload binary package
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-02-28 16:25:09 +00:00
|
|
|
- name: "Set up Go ${{ matrix.go-version }}"
|
2022-12-21 19:34:11 +00:00
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
2023-02-28 16:25:09 +00:00
|
|
|
go-version: ${{ matrix.go-version }}
|
2022-12-21 19:34:11 +00:00
|
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v3
|
2023-01-13 13:16:17 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-02-28 16:25:09 +00:00
|
|
|
submodules: false
|
|
|
|
|
|
|
|
- name: Cache Go modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
~/.cache/go-build
|
|
|
|
~/Library/Caches/go-build
|
|
|
|
%LocalAppData%\go-build
|
|
|
|
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.go-version }}-go-
|
|
|
|
|
2022-12-21 19:34:11 +00:00
|
|
|
- name: Build the binaries
|
|
|
|
run: |
|
|
|
|
make release BUILD_STATIC=yes
|
|
|
|
mv crowdsec-release.tgz crowdsec-release-static.tgz
|
|
|
|
- name: Upload to release
|
|
|
|
uses: JasonEtco/upload-to-release@master
|
|
|
|
with:
|
|
|
|
args: crowdsec-release-static.tgz application/x-gzip
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|