Skip to content

v1.0.14

v1.0.14 #126

Workflow file for this run

name: Upload build asset
on:
release:
types: [published]
jobs:
build:
name: Upload build asset for ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux amd64
os: ubuntu-latest
buildCmd: env GOOS=linux GOARCH=amd64 go build -o builds/zcli-linux-amd64 -ldflags "-s -w -X github.com/zeropsio/zcli/src/cmd.version=${{ github.event.release.tag_name }}" ./cmd/zcli/main.go
file: zcli-linux-amd64
compress: true
strip: true
runLint: true
runTests: true
- name: linux 386
os: ubuntu-latest
buildCmd: env GOOS=linux GOARCH=386 go build -o builds/zcli-linux-i386 -ldflags "-s -w -X github.com/zeropsio/zcli/src/cmd.version=${{ github.event.release.tag_name }}" ./cmd/zcli/main.go
file: zcli-linux-i386
compress: true
strip: true
runLint: true
runTests: true
- name: darwin amd64
os: macos-latest
buildCmd: env GOOS=darwin GOARCH=amd64 go build -o builds/zcli-darwin-amd64 -ldflags "-s -w -X github.com/zeropsio/zcli/src/cmd.version=${{ github.event.release.tag_name }}" ./cmd/zcli/main.go
file: zcli-darwin-amd64
compress: false
strip: false
runLint: true
runTests: true
- name: darwin arm64
os: macos-latest
buildCmd: env GOOS=darwin GOARCH=arm64 go build -o builds/zcli-darwin-arm64 -ldflags "-s -w -X github.com/zeropsio/zcli/src/cmd.version=${{ github.event.release.tag_name }}" ./cmd/zcli/main.go
file: zcli-darwin-arm64
compress: false
strip: false
runLint: false
runTests: false
- name: windows amd64
os: ubuntu-latest
buildCmd: env GOOS=windows GOARCH=amd64 go build -o builds/zcli-win-x64.exe -ldflags "-s -w -X github.com/zeropsio/zcli/src/cmd.version=${{ github.event.release.tag_name }}" ./cmd/zcli/main.go
file: zcli-win-x64.exe
compress: false
strip: false
runLint: false
runTests: false
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ~1.22
id: go
- name: Checkout code
uses: actions/checkout@v2
- name: Get dependencies
run: |
export GOPATH=$HOME/go
./tools/install.sh
- name: Build
run: ${{ matrix.buildCmd }}
- name: Compress binary
if: ${{ matrix.compress }}
uses: svenstaro/upx-action@v2
with:
file: ./builds/${{ matrix.file }}
strip: ${{ matrix.strip }}
- name: Package binaries for NPM
run: tar -czvf ${{ matrix.file }}-npm.tar.gz builds/${{ matrix.file }}
- name: Upload asset for NPM
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ matrix.file }}-npm.tar.gz
asset_name: ${{ matrix.file }}-npm.tar.gz
asset_content_type: application/octet-stream
- name: Upload asset clean bin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./builds/${{ matrix.file }}
asset_name: ${{ matrix.file }}
asset_content_type: application/octet-stream
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: |
cd tools/npm
npm ci --ignore-scripts
npm i -g replace-in-files-cli
replace-in-files --string='v0.0.0-zerops' --replacement='${{ github.event.release.tag_name }}' package.json
npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}