name: build on: push: tags: - '*' jobs: publish_release: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@master - name: Create release uses: actions/create-release@v1 id: create_release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} body: | Changes in this Release - First Change - Second Change draft: true prerelease: true - name: Setup Go uses: actions/setup-go@v1 with: go-version: '1.13.5' - name: Build run: | cd cmd/tcping env VERSION=$(echo ${GITHUB_REF:10}) GIN_MODE=release GOOS=linux GOARCH=amd64 bash -c 'go build -ldflags "-X main.VersionString=$VERSION" -o tcping-linux-amd64 *.go' env VERSION=$(echo ${GITHUB_REF:10}) GIN_MODE=release GOOS=darwin GOARCH=amd64 bash -c 'go build -ldflags "-X main.VersionString=$VERSION" -o tcping-darwin-amd64 *.go' ls -lha - name: Upload binary linux uses: actions/upload-release-asset@v1.0.1 id: upload-release-asset-linux env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./cmd/tcping/tcping-linux-amd64 asset_name: tcping-linux-amd64 asset_content_type: application/octet-stream - name: Upload binary darwin uses: actions/upload-release-asset@v1.0.1 id: upload-release-asset-darwin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./cmd/tcping/tcping-darwin-amd64 asset_name: tcping-darwin-amd64 asset_content_type: application/octet-stream