Skip to content

Commit

Permalink
Add build and release gh actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
adamaziz15 committed Nov 9, 2023
1 parent 910681e commit 5b50c9e
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 6 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Release

on:
push:
branches:
- main
- aa/initial-setup # TODO: remove this after testing workflow

jobs:
build-and-release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21

- name: Build CLI
run: |
go build -o cocli main.go
# Add any additional build steps if needed
- name: Set Tag Name
id: set_tag_name
run: echo "TAG_NAME=$(cat cocli_version.txt)" >> $GITHUB_ENV

- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ env.TAG_NAME }}
release_name: Release v${{ env.TAG_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cocli
asset_name: cocli
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions cocli_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
24 changes: 18 additions & 6 deletions pkg/cocli/cocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (

// For dev (main/review)
const (
clientID = "O5AkI9iHd4Okb3DCmu1P0em4YXFjAPr5"
authDomain = "dev-mkiob4vl.us.auth0.com"
credsFilename = "~/.cocli/.authtoken"
// coherenceDomain = "aa-external-cocli.control-plane-review.coherence.coherencesites.com"
coherenceDomain = "126bdeab-68f9-4d29-a22d-51f193623390-web.coherencedev.com"
clientID = "O5AkI9iHd4Okb3DCmu1P0em4YXFjAPr5"
authDomain = "dev-mkiob4vl.us.auth0.com"
credsFilename = "~/.cocli/.authtoken"
coherenceDomain = "aa-external-cocli.control-plane-review.coherence.coherencesites.com"
// coherenceDomain = "126bdeab-68f9-4d29-a22d-51f193623390-web.coherencedev.com"
// coherenceDomain = "main.control-plane-review.coherence.coherencesites.com"
)

Expand All @@ -44,7 +44,19 @@ var oauthConfig = &oauth2.Config{
}

func GetCliVersion() string {
return "0.0.1"
filePath := "cocli_version.txt"
file, err := os.Open(filePath)
if err != nil {
panic(err)
}
defer file.Close()

content, err := io.ReadAll(file)
if err != nil {
panic(err)
}

return string(content)
}

func GetCoherenceApiPrefix() string {
Expand Down

0 comments on commit 5b50c9e

Please sign in to comment.