Skip to content

Commit

Permalink
test latest release of cli.yml on this branch
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter committed Aug 7, 2023
1 parent e2701a1 commit b5819a9
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Viam CLI

on:
workflow_dispatch:
inputs:
release_type:
required: true
type: string
workflow_call:
inputs:
release_type:
required: true
type: string
secrets:
GCP_CREDENTIALS:
required: true

jobs:
viam-cli:
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
# todo: pin this for prod
go-version: '1.20.x'

# todo(ask): factor out this conditional checkout behavior? why not always use current?
- name: Check out code
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
uses: actions/checkout@v3
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: vars
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: go build -ldflags="-X main.CliVersion=${{ steps.vars.outputs.sha_short }}" ./cli/viam

- name: Authorize GCP Upload
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: upload
uses: google-github-actions/upload-cloud-storage@v0.10.4
with:
headers: "cache-control: no-cache"
path: 'viam'
destination: 'packages.viam.com/apps/viam-cli/viam-${{ inputs.release_type }}-${{ matrix.goos }}-${{ matrix.goarch }}'
parent: false # what
gzip: false # why
# todo: also `gs mv` for tagged release
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ jobs:
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}

cli:
# uses: viamrobotics/rdk/.github/workflows/cli.yml@main
uses: ./cli.yml # DONOTMERGE
with:
release_type: 'latest'
secrets:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}

npm_publish:
uses: viamrobotics/rdk/.github/workflows/npm-publish.yml@main
needs: test
Expand Down

0 comments on commit b5819a9

Please sign in to comment.