Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Add workflow
Browse files Browse the repository at this point in the history
Added build and publish artifacts
  • Loading branch information
VijayanB committed Jul 28, 2020
1 parent 2e49d94 commit 33a505e
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 10 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/esad-cli-publish-artifact-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish
This workflows is triggered on creating tags to master
#on:
# push:
# tags:
# - 'v*'
on: [pull_request, push]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: cli
steps:
- name: Set up Go ubuntu-latest
uses: actions/setup-go@v2
with:
go-version: 1.14

- name: Check out AD CLI
uses: actions/checkout@v2

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: --snapshot --skip-publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Mac Artifact
uses: actions/upload-artifact@v2
with:
name: esad-darwin-amd64
path: cli/dist/esad_darwin_amd64/esad

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: esad-linux-amd64
path: cli/dist/esad_linux_amd64/esad

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: esad-windows-386
path: cli/dist/esad_windows_386/esad.exe

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: esad-windows-amd64
path: cli/dist/esad_windows_amd64/esad.exe

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: esad-linux-arm64
path: cli/dist/esad_linux_arm64/esad
21 changes: 11 additions & 10 deletions .github/workflows/esad-cli-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
name: Build and Test Anomaly detection commandline tool
on:
push:
branches:
- master
- opendistro-*
pull_request:
branches:
- master
- opendistro-*
name: AD CLI Test and Build
on: [pull_request, push]

jobs:
build:
defaults:
run:
working-directory: cli
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
Expand Down Expand Up @@ -46,6 +42,11 @@ jobs:
id: git-check
run: |
echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Display unformated changes
if: steps.git-check.outputs.modified == 'true'
run: |
echo "Failed to format using go-fmt".
git diff
- uses: actions/checkout@v2
- name: golangci-lint
Expand Down
38 changes: 38 additions & 0 deletions cli/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: esad
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- 386
- amd64
- arm
- arm64
ignore:
- goos: darwin
goarch: 386
archives:
-
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
checksum:
name_template: '{{ .ProjectName }}_checksums.txt'
snapshot:
name_template: '{{ .ProjectName }}_{{ .Version }}'

0 comments on commit 33a505e

Please sign in to comment.