diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 5b0e736c..85ff9676 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -7,58 +7,41 @@ on: jobs: build: - name: Upload build asset - runs-on: ubuntu-latest + name: Upload build asset for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + buildCmd: env GOOS=linux GOARCH=amd64 go build -o zcli-linux ./main.go + file: zcli-linux + args: --better + strip: true + - os: macos-latest + buildCmd: env GOOS=darwin GOARCH=amd64 go build -o zcli-mac ./main.go + file: zcli-mac + args: --better + strip: true + steps: - name: Checkout code uses: actions/checkout@v2 - - name: Build project for linux - run: env GOOS=linux GOARCH=amd64 go build -o zcli-linux ./main.go - - - name: Compress linux binary - uses: svenstaro/upx-action@v1-release - with: - file: ./zcli-linux - - - name: Build project for mac - run: env GOOS=darwin GOARCH=amd64 go build -o zcli-mac ./main.go + - name: Build + run: ${{ matrix.buildCmd }} - - name: Compress mac binary + - name: Compress binary uses: svenstaro/upx-action@v1-release with: - file: ./zcli-mac + file: ./${{ matrix.file }} - - name: Create release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false - - - name: Upload linux asset - id: upload-linux-asset + - name: Upload asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./zcli-linux - asset_name: zcli-linux + asset_path: ./${{ matrix.file }} + asset_name: ${{ matrix.file }} asset_content_type: application/octet-stream - - - name: Upload mac asset - id: upload-mac-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./zcli-mac - asset_name: zcli-mac - asset_content_type: application/octet-stream \ No newline at end of file