Skip to content

Commit

Permalink
Merge pull request #16 from CptOfEvilMinions/initial-cicd
Browse files Browse the repository at this point in the history
Upadate - 13
  • Loading branch information
CptOfEvilMinions authored Dec 28, 2021
2 parents b2f098d + 5208f92 commit 9daaa68
Showing 1 changed file with 21 additions and 30 deletions.
51 changes: 21 additions & 30 deletions .github/workflows/tagged-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,28 @@ on:
- 'v*'

jobs:
create_release:
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

######################################## Create release ########################################
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- run: go version
- name: Get GO deps
run: go mod download
- name: Build osctrl-tls
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ./bin/osctrl-${{ matrix.components }}-${{ github.ref }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin ./${{ matrix.components }}
create_release:
runs-on: ubuntu-20.04
steps:
- name: Create Release
uses: actions/create-release@v1
id: create_release
Expand All @@ -32,31 +46,8 @@ jobs:
components: ['tls', 'admin', 'api', 'cli']
goos: ['linux']
goarch: ['amd64']
steps:
######################################## Download artifacts and unzip ########################################
- name: Download a single artifact
uses: actions/download-artifact@v2
with:
name: osctrl-binaries-${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
needs: [create_zip_of_build_artifacts]
- name: List contents
run: ls -l
needs: [create_zip_of_build_artifacts]
- name: Unzip
run: unzip osctrl-binaries-${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}.zip
needs: [create_zip_of_build_artifacts]
- name: List contents
run: ls -l
needs: [create_zip_of_build_artifacts]
- name: Rename binary
id: rename_binary
run: mv osctrl-${{ matrix.components }}-linux-amd64.bin osctrl-${{ matrix.components }}-${{ github.ref }}-linux-amd64.bin
needs: [create_zip_of_build_artifacts]

######################################## Add build artifacts to release ########################################
- name: Release
steps:
- name: Add build artifacts to release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: 'osctrl-*.bin'
needs: [create_zip_of_build_artifacts, rename_binary]
files: '/bin/osctrl-*.bin'

0 comments on commit 9daaa68

Please sign in to comment.