v1.0.28 #142
Workflow file for this run
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: Tag | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
name: Build & upload ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
env: | |
CGO_ENABLED: '0' | |
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: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
id: go | |
- 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 [email protected] | |
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}} | |
report: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify discord about new release | |
uses: sarisia/[email protected] | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
title: "New version of `zcli` is ready!" | |
nocontext: 'true' | |
description: | | |
Version `${{ github.event.release.tag_name }}` | |
Changelog [here](${{ github.event.release.html_url }}) | |
color: 0xff91a4 | |
username: GitHub |