fix new line (to squash) #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: [push] | |
jobs: | |
build: | |
name: Build plugin | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@master | |
- name: Get Next Tag | |
id: tag_version | |
uses: SOLIDSoftworks/semver-tags@1.0.1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} | |
tag-prefix: 'v' | |
dry-run: true | |
- name: Update kubectl-login Version | |
env: | |
KLOGIN_VERSION: ${{ steps.tag_version.outputs.semantic-version }} | |
run: | | |
CURRENT_VERSION=$(cat main.go | grep 'const version' | tr -d \" | awk -F ' ' '{print $NF}') | |
sed -i "s/$CURRENT_VERSION/$KLOGIN_VERSION/" main.go | |
- name: Setup Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: '1.17' | |
- name: Run tests | |
run: go test ./... | |
- name: Build Linux binary | |
run: | | |
go build -o dist/linux/amd64/kubectl-login | |
zip -j kubectl-login-linux dist/linux/amd64/kubectl-login | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
- name: Build Mac OS binary | |
run: | | |
go build -o dist/darwin/amd64/kubectl-login | |
zip -j kubectl-login-macos dist/darwin/amd64/kubectl-login | |
env: | |
GOOS: darwin | |
GOARCH: amd64 | |
- name: Build Windows binary | |
run: | | |
go build -o dist/windows/amd64/kubectl-login.exe | |
zip -j kubectl-login-windows dist/windows/amd64/kubectl-login.exe | |
env: | |
GOOS: windows | |
GOARCH: amd64 | |
if: github.ref_name == 'master' | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.tag_version.outputs.semantic-version }} | |
release_name: v${{ steps.tag_version.outputs.semantic-version }} | |
if: github.ref_name == 'master' | |
- name: Upload Mac Release Asset | |
id: upload-mac-os-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./kubectl-login-macos.zip | |
asset_name: kubectl-login-macos.zip | |
asset_content_type: application/zip | |
if: github.ref_name == 'master' | |
- name: Upload Linux Release Asset | |
id: upload-linux-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./kubectl-login-linux.zip | |
asset_name: kubectl-login-linux.zip | |
asset_content_type: application/zip | |
if: github.ref_name == 'master' | |
- name: Upload Windows Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./kubectl-login-windows.zip | |
asset_name: kubectl-login-windows.zip | |
asset_content_type: application/zip | |
if: github.ref_name == 'master' |