Only run workflow on pull request if it comes from a fork (push will already be running if it is an internal PR)

Use softprops/action-gh-release to attach binaries to release.

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2021-10-13 19:34:58 +01:00
parent ded010c356
commit f9bb12d250
+6 -4
View File
@@ -10,6 +10,7 @@ on:
jobs:
define-shared-vars:
if: ${{ github.event_name == 'push' || github.event_name == 'release' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
runs-on: ubuntu-latest
outputs:
GIT_TAG: ${{ steps.variables.outputs.GIT_TAG }}
@@ -28,6 +29,7 @@ jobs:
echo ::set-output name=OUTPUT_DIR::${GIT_TAG:-${GIT_BRANCH}}
build-and-test-x86-32-64:
if: ${{ github.event_name == 'push' || github.event_name == 'release' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
needs: define-shared-vars
env:
GIT_TAG: ${{ needs.define-shared-vars.outputs.GIT_TAG }}
@@ -76,6 +78,7 @@ jobs:
path: '${{ matrix.bin_name }}*'
build-arm-aarch64:
if: ${{ github.event_name == 'push' || github.event_name == 'release' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
needs: [ build-and-test-x86-32-64, define-shared-vars]
env:
GIT_TAG: ${{ needs.define-shared-vars.outputs.GIT_TAG }}
@@ -150,8 +153,7 @@ jobs:
-
name: Attach binaries to release
if: ${{ github.event_name == 'release' }}
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
args: '*'
files: |
*