I am trying to put together an action to create artefacts to attach to a new release, but I am running into an issue. If I create a new release in the GitHub UI of the form ‘v3.1.5’, then I find the action is fired off three times, but I am not sure why. Can anyone tell me what I am doing wrong:
on:
release:
type: [created]
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Upload Release Asset
jobs:
release:
name: Upload Release Asset
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Get dependencies
run: git submodule update --init --recursive
- name: Build the project
run: xcodebuild -derivedDataPath ./build -workspace Boxer.xcworkspace -scheme "Boxer CI" -configuration "Release"
- name: Package the release artefacts
run: |
hdiutil create -volname Boxer -srcfolder build/Build/Products/Release/Boxer.app -ov -format UDZO Boxer.dmg
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.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
asset_path: ./Boxer.dmg
asset_name: Boxer.dmg
asset_content_type: application/x-apple-diskimage