-
Select Topic AreaQuestion BodyHi all! I started from this and tried to customize, 'cause I don't want it on API, but on creating a new release from web console. Here what I made up to now: on:
release:
types: [created]
branches:
- '*'
name: Upload Release Asset On Release Publish
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
zip --junk-paths -r Greetings.zip Greetings LICENSE README.md
- name: View project
run: |
unzip -l Greetings.zip
#- 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
upload_url: ${{ github.server_url }}/${{ github.repository }}/releases/${{ github.ref_name }} # while not calling create_release, this is the path handmade
asset_path: ./Greetings.zip
asset_name: Greetings.zip
asset_content_type: application/zip
- name: Upload Release Asset Output
run: echo "💡 File available in ${{ steps.upload_release_asset.outputs.browser_download_url }}" I doesn't return error, but it also does nothing. Probably I'm just doing a mess, and I don't know. There's any other way I could obtain that result? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I resolved adopting this one: name: GH Upload Release Asset On Release Publish
on:
release:
types: [published]
branches:
- '*'
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build Release Asset
run: |
rsync -Rr --exclude=".*" . ./Greetings
zip -r Greetings_${{ github.ref_name }}.zip Greetings
rm -r Greetings
- name: View Release Asset
run: |
unzip -l Greetings_${{ github.ref_name }}.zip
- name: Upload Release Asset
id: upload_release_asset
uses: softprops/action-gh-release@v2
with:
files: Greetings_${{ github.ref_name }}.zip
- name: Release Output
run: echo "💡 Release available in ${{ steps.upload_release_asset.outputs.url }}"
- name: Uploaded Release Assets Output
run: echo "💡 Assets available ${{ steps.upload_release_asset.outputs.assets }}" |
Beta Was this translation helpful? Give feedback.
I resolved adopting this one: