diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea7ac4a..7907114 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,6 +18,7 @@ jobs: id: ${{ steps.create_release.outputs.id }} html_url: ${{ steps.create_release.outputs.html_url }} upload_url: ${{ steps.create_release.outputs.upload_url }} + tag: ${{ steps.version.outputs.value }} steps: # Obtain the tag version @@ -38,7 +39,7 @@ jobs: # Now we build each version and add it to the GitHub release build: needs: release - runs-on: ubuntu-latest + runs-on: windows-latest name: Build for ${{ matrix.os }}/${{ matrix.arch }} strategy: matrix: @@ -70,23 +71,15 @@ jobs: path: ~/go/pkg/mod key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} - # Obtain the tag version - - id: version - run: echo ::set-output name=value::${GITHUB_REF#refs/tags/} - # Setting the extension of the output file - id: extension run: | - if [ "${{ matrix.os }}" == "windows" ]; then - echo ::set-output name=value::.exe - else - echo ::set-output name=value:: - fi + echo "::set-output name=value::$(If ('${{ matrix.os }}' -Eq 'windows') {'.exe'} Else {''})" # Perform the actual build - run: >- go build - -o "${{ env.name }}_v${{ steps.version.outputs.value }}${{ steps.extension.outputs.value }}" + -o "${{ env.name }}_v${{ needs.release.outputs.tag }}${{ steps.extension.outputs.value }}" env: GO111MODULE: 'on' GOOS: ${{ matrix.os }} @@ -95,7 +88,7 @@ jobs: # Zip it up so we can rename the artifact while keeping correct name of terraform provider - run: >- - zip --junk-paths build.zip "${{ env.name }}_v${{ steps.version.outputs.value }}${{ steps.extension.outputs.value }}" + zip --junk-paths build.zip "${{ env.name }}_v${{ needs.release.outputs.tag }}${{ steps.extension.outputs.value }}" # Upload the artifact - uses: actions/upload-release-asset@v1 @@ -104,5 +97,5 @@ jobs: with: upload_url: ${{ needs.release.outputs.upload_url }} asset_path: build.zip - asset_name: ${{ env.name }}-${{ steps.version.outputs.value }}-${{ matrix.os }}-${{ matrix.arch }}.zip + asset_name: ${{ env.name }}-${{ needs.release.outputs.tag }}-${{ matrix.os }}-${{ matrix.arch }}.zip asset_content_type: application