Skip to content

Commit

Permalink
Merge pull request #1 from CptOfEvilMinions/initial-cicd
Browse files Browse the repository at this point in the history
Initial cicd
  • Loading branch information
CptOfEvilMinions authored Dec 27, 2021
2 parents c13b32f + be8eed8 commit 97e1a28
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 25 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/build-test.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build OSctrl binaries

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
components: ['tls', 'admin', 'api', 'cli']
goos: ['linux']
goarch: ['amd64']
steps:
######################################## Checkout code ########################################
- name: Checkout code
uses: actions/checkout@v2

######################################## Install go to env ########################################
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- run: go version

######################################## Get GO deps ########################################
- name: Get GO deps
run: go mod download

######################################## Build osctrl component ########################################
- name: Build osctrl-tls
run: mkdir ./bin
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ./bin/osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin ./${{ matrix.components }}/main.go

######################################## Create ZIP of build artifacts ########################################
- name: Create ZIP of build artifacts
uses: actions/upload-artifact@v2
with:
name: osctrl-binaries.zip
path: bin
43 changes: 43 additions & 0 deletions .github/workflows/tagged-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
create:
tags:
- 'v*'

name: Create Release
jobs:
build:
name: Create Release
runs-on: ubuntu-20.04
strategy:
matrx:
components: ['tls', 'admin', 'api', 'cli']
goos: ['linux']
goarch: ['amd64']
steps:
######################################## Checkout code ########################################
- name: Checkout code
uses: actions/checkout@v2

######################################## Create release ########################################
- name: Create Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
draft: false
prerelease: false
release_name: Release ${{ github.ref }}
tag_name: ${{ github.ref }}
body_path: CHANGELOG.md

######################################## Add build artifacts to release ########################################
- name: Add build artifacts to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin
asset_name: osctrl-${{ matrix.components }}-${{ github.ref }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin
asset_content_type: application/x-binary
Empty file added CHANGELOG.md
Empty file.

0 comments on commit 97e1a28

Please sign in to comment.