Skip to content

πŸ§‘β€πŸ’» login command - print selected username to avoid ambiguity #651

πŸ§‘β€πŸ’» login command - print selected username to avoid ambiguity

πŸ§‘β€πŸ’» login command - print selected username to avoid ambiguity #651

Workflow file for this run

name: Go
on:
push:
branches: [ '*' ]
tags: [ '*.*.*', '*.*.*-*', 'test-release-*' ]
pull_request:
branches: [ 'main', 'v*.*.*' ]
env:
CDT_VAULT_SECRET: very_secret
jobs:
build:
runs-on: ${{ matrix.os }}
outputs:
sha_short: ${{steps.vars.outputs.sha_short}}
arch: ${{steps.vars.outputs.arch}}
os: ${{steps.vars.outputs.os}}
strategy:
matrix:
arch: [amd64,arm64]
cgo: [0]
os: [windows-latest, ubuntu-latest ]
include:
- os: macos-latest
arch: arm64
cgo: 1
- os: macos-latest
arch: amd64
cgo: 1
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: gh-pages/package-lock.json
- name: generate vars
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=arch::${{matrix.arch}}"
echo "::set-output name=os::$(go run test/get-os.go)"
echo "::set-output name=ext::$(go run test/get-os.go extension)"
- name: Build
env:
GOARCH: ${{matrix.arch}}
CGO_ENABLED: ${{matrix.cgo}}
run: |
go build -o build/cdt_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{steps.vars.outputs.sha_short}} -ldflags='-X main.version=${{github.ref_name}} -X main.buildNum=${{github.run_number}} -X main.appName=cdt'
go build -o build/cola_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{steps.vars.outputs.sha_short}} -ldflags="-X main.version=${{github.ref_name}} -X main.buildNum=${{github.run_number}} -X main.appName=cola -X 'main.appLongName=Command Launcher'"
- name: Test & Benchmark
run: go test -v ./...
- name: Integration-test
run: |
echo "${{github.workspace}}/test"
SCRIPT_DIR='${{github.workspace}}/test' test/integration.sh
shell: bash
- name: documentation lint
run: cd gh-pages && npm install && npm run test
- name: Upload CDT
uses: actions/upload-artifact@v3
with:
name: ${{steps.vars.outputs.os}}-${{matrix.arch}}
path: build/cdt_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{steps.vars.outputs.sha_short}}
- name: Upload COLA
uses: actions/upload-artifact@v3
with:
name: ${{steps.vars.outputs.os}}-${{matrix.arch}}
path: build/cola_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{steps.vars.outputs.sha_short}}
- name: Rename binary name for release
if: startsWith(github.ref, 'refs/tags/')
run: |
mv build/cdt_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{steps.vars.outputs.sha_short}} build/cdt_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{github.ref_name}}${{steps.vars.outputs.ext}}
mv build/cola_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{steps.vars.outputs.sha_short}} build/cola_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{github.ref_name}}${{steps.vars.outputs.ext}}
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
build/cdt_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{github.ref_name}}${{steps.vars.outputs.ext}}
build/cola_${{steps.vars.outputs.os}}_${{matrix.arch}}_${{github.ref_name}}${{steps.vars.outputs.ext}}
packaging:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Download linux amd64 artifact
uses: actions/download-artifact@v3
with:
name: linux-amd64
path: output/linux/amd64/
- name: Download linux arm64 artifact
uses: actions/download-artifact@v3
with:
name: linux-arm64
path: output/linux/arm64/
- name: Download windows amd64 artifact
uses: actions/download-artifact@v3
with:
name: windows-amd64
path: output/windows/amd64/
- name: Download darwin amd64 artifact
uses: actions/download-artifact@v3
with:
name: darwin-amd64
path: output/darwin/amd64/
- name: Download darwin-arm64 artifact
uses: actions/download-artifact@v3
with:
name: darwin-arm64
path: output/darwin/arm64/
- name: Rename binary name
run: |
mv output/darwin/arm64/cdt_darwin_arm64_${{needs.build.outputs.sha_short}} output/darwin/arm64/cdt
mv output/darwin/amd64/cdt_darwin_amd64_${{needs.build.outputs.sha_short}} output/darwin/amd64/cdt
mv output/linux/amd64/cdt_linux_amd64_${{needs.build.outputs.sha_short}} output/linux/amd64/cdt
mv output/linux/arm64/cdt_linux_arm64_${{needs.build.outputs.sha_short}} output/linux/arm64/cdt
mv output/windows/amd64/cdt_windows_amd64_${{needs.build.outputs.sha_short}} output/windows/amd64/cdt.exe
- name: Zip the package
uses: thedoctor0/zip-release@master
if: startsWith(github.ref, 'refs/tags/')
with:
type: 'zip'
filename: cdt_${{github.ref_name}}.zip
directory: output
- name: Upload
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/tags/')
with:
name: all-in-one.zip
path: output/cdt_${{github.ref_name}}.zip
- name: Display structure of downloaded files
run: ls -R
working-directory: output
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: output/cdt_${{github.ref_name}}.zip
update-latest-version:
needs: [ packaging ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Generate latest version file
run: |
mkdir output
cat release-notes.yaml | yq -r '."${{github.ref_name}}"' > output/latest.yaml
- name: Display latest version file content
run: cat output/latest.yaml
- name: Upload latest version index
uses: actions/upload-artifact@v3
with:
name: latest.yaml
path: output/latest.yaml
- name: Release & Update the version index
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: output/latest.yaml