diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f499795..18b7d6d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,11 +12,17 @@ on: - "go.sum" jobs: - test: + build: + runs-on: ${{ matrix.os }} strategy: matrix: - platform: [ubuntu-latest, windows-latest, macos-latest] - runs-on: ${{ matrix.platform }} + include: + - os: ubuntu-latest + TARGET: linux + - os: windows-latest + TARGET: windows + - os: macos-latest + TARGET: darwin timeout-minutes: 5 env: GO111MODULE: on @@ -24,7 +30,7 @@ jobs: - name: Checkout code uses: actions/checkout@v1 - name: Format - run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi + run: if [ "$(gofmt -l `find . -name '*.go' | grep -v vendor` 2>&1)" ]; then exit 1; fi if: matrix.os == 'ubuntu-latest' - name: Build run: bazel build //cmd/bmx:bmx @@ -38,5 +44,76 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v2 with: - name: bmx-${{ matrix.platform }} - path: artifacts/ \ No newline at end of file + name: bmx-${{ matrix.TARGET }} + path: artifacts/ + release: + name: Create Github Release + if: contains(github.ref, 'tags/') + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + + - name: Output Release URL File + run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt + + - name: Save Release URL File for publish + uses: actions/upload-artifact@v1 + with: + name: release_url + path: release_url.txt + publish: + if: contains(github.ref, 'tags/') + needs: [build, release] + runs-on: ubuntu-latest + strategy: + matrix: + include: + - os: ubuntu-latest + TARGET: linux + - os: windows-latest + TARGET: windows + - os: macos-latest + TARGET: darwin + steps: + - name: Load Release URL File from release job + uses: actions/download-artifact@v1 + with: + name: release_url + path: /tmp/release_url + + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: bmx-${{ matrix.TARGET }} + path: artifacts/ + + - name: Get Release File Name & Upload URL + id: get_release_info + run: | + echo ::set-output name=file_name::${REPOSITORY_NAME##*/}-${TAG_REF_NAME##*/v} + value=`cat /tmp/release_url/release_url.txt` + echo ::set-output name=upload_url::$value + env: + TAG_REF_NAME: ${{ github.ref }} + REPOSITORY_NAME: ${{ github.repository }} + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./artifacts/package.tar + asset_name: ${{ steps.get_release_info.outputs.file_name }}-${{ matrix.TARGET }}.tar + asset_content_type: application/zip \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 24c3a2f..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: GitHub Release -on: - push: - tags: - - v* - -jobs: - release: - name: Release on GitHub - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v1 - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index a65f459..0000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,24 +0,0 @@ -builds: - - binary: "{{.ProjectName}}_v{{.Version}}" - main: ./cmd/bmx/ - env: - - GO111MODULE=on - - CGO_ENABLED=0 - goos: - - linux - - darwin - - windows - goarch: - - amd64 -archives: - - format: zip -checksum: - name_template: "checksums.txt" -changelog: - skip: true -release: - github: - owner: rtkwlf - name: bmx - prerelease: auto - name_template: "v{{.Version}}" diff --git a/console/AppleScript.go b/console/AppleScript.go index 982bcf3..ca5fd5b 100644 --- a/console/AppleScript.go +++ b/console/AppleScript.go @@ -134,7 +134,7 @@ func (r AppleScriptConsole) Option(message string, prompt string, options []stri listOptions := mack.ListOptions{ Items: options, - Title: fmt.Sprintf("BMX Option Prompt: %s", message), + Title: fmt.Sprintf("BMX Option Prompt: %s", message), Message: prompt, } response, didCancel, err := mack.ListWithOpts(listOptions) diff --git a/console_test.go b/console_test.go index 7806929..f647582 100644 --- a/console_test.go +++ b/console_test.go @@ -25,11 +25,11 @@ func TestFindAppByLabels(t *testing.T) { } dataset := []okta.OktaAppLink{ - okta.OktaAppLink{Label: "awsAppTesting1"}, - okta.OktaAppLink{Label: "myTestApp2"}, - okta.OktaAppLink{Label: "testingForAws"}, - okta.OktaAppLink{Label: "MyAwsApp"}, - okta.OktaAppLink{Label: "NotAnAwsApp"}, + {Label: "awsAppTesting1"}, + {Label: "myTestApp2"}, + {Label: "testingForAws"}, + {Label: "MyAwsApp"}, + {Label: "NotAnAwsApp"}, } for _, test := range expectedLabels {