Skip to content

Commit b979bb3

Browse files
authored
create continuous deployment workflow (opendistro-for-elasticsearch#15)
Create goreleaser configuration to generate binary for multiple os and architecture. Added github actions to generate binary and upload to github page when a release tag is created. Later, we will be adding actions to upload to s3 bucket to make this avaialabe for download page.
1 parent d956305 commit b979bb3

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish odfe-cli
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Set up Go ubuntu-latest
12+
uses: actions/setup-go@v2
13+
with:
14+
go-version: 1.14
15+
16+
- name: Check out source code
17+
uses: actions/checkout@v2
18+
19+
- name: Run GoReleaser
20+
uses: goreleaser/goreleaser-action@v2
21+
with:
22+
version: latest
23+
args: --snapshot --skip-publish
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Upload macOS(amd64) Artifact
28+
uses: actions/upload-artifact@v2
29+
with:
30+
name: odfe-cli-macOS-amd64
31+
path: dist/odfe-cli_darwin_amd64/odfe-cli
32+
33+
- name: Upload Linux(amd64) Artifact
34+
uses: actions/upload-artifact@v2
35+
with:
36+
name: odfe-cli-linux-amd64
37+
path: dist/odfe-cli_linux_amd64/odfe-cli
38+
39+
- name: Upload Linux(arm64) Artifact
40+
uses: actions/upload-artifact@v2
41+
with:
42+
name: odfe-cli-linux-arm64
43+
path: dist/odfe-cli_linux_arm64/odfe-cli
44+
45+
- name: Upload Windows(i386) Artifact
46+
uses: actions/upload-artifact@v2
47+
with:
48+
name: odfe-cli-windows-386
49+
path: dist/odfe-cli_windows_386/odfe-cli.exe
50+
51+
- name: Upload Windows(amd64) Artifact
52+
uses: actions/upload-artifact@v2
53+
with:
54+
name: odfe-cli-windows-amd64
55+
path: dist/odfe-cli_windows_amd64/odfe-cli.exe

.goreleaser.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This is an example goreleaser.yaml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
project_name: odfe-cli
4+
dist: ./dist
5+
before:
6+
hooks:
7+
# You may remove this if you don't use go modules.
8+
- go mod download
9+
builds:
10+
- env:
11+
- CGO_ENABLED=0
12+
goos:
13+
- linux
14+
- windows
15+
- darwin
16+
goarch:
17+
- 386
18+
- amd64
19+
- arm
20+
- arm64
21+
ignore:
22+
- goos: darwin
23+
goarch: 386
24+
archives:
25+
-
26+
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
27+
replacements:
28+
darwin: Darwin
29+
linux: Linux
30+
windows: Windows
31+
386: i386
32+
amd64: x86_64
33+
format_overrides:
34+
- goos: windows
35+
format: zip
36+
checksum:
37+
name_template: '{{ .ProjectName }}_checksums.txt'
38+
snapshot:
39+
name_template: '{{ .ProjectName }}_{{ .Version }}'

0 commit comments

Comments
 (0)