diff --git a/.github/workflows/release-windows.yaml b/.github/workflows/release-windows.yaml new file mode 100644 index 0000000..5a93c3f --- /dev/null +++ b/.github/workflows/release-windows.yaml @@ -0,0 +1,57 @@ +# compiles Windows artifacts and attaches them to build +name: Release Windows + +on: + release: + # Only use the types keyword to narrow down the activity types that will trigger your workflow. + types: [published] + + # for testing, we can also trigger manually. remove this afterwards. + workflow_dispatch: + inputs: + version_bump_type: + description: 'noop' + required: false + default: 'patch' + +jobs: + + release-windows: + name: Release Windows + runs-on: windows-latest + env: + PROJECT_PATH: /go/src/github.com/analogj/scrutiny + GOPATH: /go + GOOS: windows + GOARCH: amd64 + steps: + - name: Checkout + uses: actions/checkout@v2 +# TODO: uncomment this +# with: +# ref: ${{github.event.release.tag_name}} + - uses: actions/setup-go@v2 + with: + go-version: '^1.13.1' # The Go version to download (if necessary) and use. + - name: Build Binaries + run: | + + mkdir -p $(dirname "$PROJECT_PATH") + cp -R $GITHUB_WORKSPACE $PROJECT_PATH + cd $PROJECT_PATH + + mkdir -p $GITHUB_WORKSPACE/dist + + echo "building collector binary (OS = ${GOOS}, ARCH = ${GOARCH})" + go build -ldflags "-extldflags=-static -X main.goos=${GOOS} -X main.goarch=${GOARCH}" -o $GITHUB_WORKSPACE/dist/scrutiny-collector-metrics-${GOOS}-${GOARCH}.exe -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go + + - name: Release Asset - Collector - windows-amd64 + id: upload-release-asset2 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: './dist/scrutiny-collector-metrics-windows-amd64' + asset_name: scrutiny-collector-metrics-windows-amd64 + asset_content_type: application/octet-stream