I am trying to create a GitHub Action that is triggered when a release is published and will build my project and upload certain artefacts as release assets. The only examples I can find rely on using the create-release
action, which fails as the release has already been created. My workflow file is like so:
name: Build for Release
on:
release:
types: [published]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: ...
- name: Zip Asset
run: ...
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ ???? What Goes Here ???? }}
asset_path: build/MyProject.zip
asset_name: MyProject.zip
asset_content_type: application/zip
My tags will be v0.1.0
, v0.1.1
, v0.2.0
etc and the release name matches these.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…