Skip to content

Commit

Permalink
refinement: release workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmoriarty committed Jun 2, 2021
1 parent 800f1f0 commit 8234d73
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
release:
runs-on: macos-latest

outputs:
version: ${{ steps.get_version.outputs.version }}
upload_url: ${{ steps.create_release.outputs.upload_url }}

steps:
- uses: actions/create-release@v1
env:
Expand All @@ -21,12 +25,8 @@ jobs:
prerelease: false
id: create_release

- run: echo "${{ steps.create_release.outputs.upload_url }}" > upload_url.txt

- uses: actions/upload-artifact@v1
with:
name: upload_url
path: upload_url.txt
- id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}

build:
strategy:
Expand Down Expand Up @@ -58,22 +58,11 @@ jobs:
GOARCH: ${{ matrix.target.goarch }}
CGO_ENABLED: 1
- uses: actions/download-artifact@v1
with:
name: upload_url

- id: get_release_info
run: |
echo "##[set-output name=upload_url;]$(cat upload_url/upload_url.txt)"
env:
TAG_REF_NAME: ${{ github.ref }}
REPOSITORY_NAME: ${{ github.repository }}

- uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.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
upload_url: ${{ needs.release.outputs.upload_url}}
asset_path: ./${{ matrix.target.goos }}-${{ matrix.target.goarch }}${{ matrix.target.ext }}
asset_name: ${{ matrix.target.goos }}-${{ matrix.target.goarch }}${{ matrix.target.ext }}
asset_name: gohack_${{ needs.release.outputs.version }}_${{ matrix.target.goos }}-${{ matrix.target.goarch }}${{ matrix.target.ext }}
asset_content_type: application/zip

0 comments on commit 8234d73

Please sign in to comment.