svenstaro/upload-release-action — 722★ trên GitHub (TypeScript). Upload files to a GitHub release
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
This action allows you to select which files to upload to the just-tagged release.
It runs on all operating systems types offered by GitHub.
Input variables
You must provide:
file: A local file to be uploaded as the asset.
Optional Arguments
Argument
Default
Description
repo_token
github.token
Defaults to github.token.
tag
github.ref
The tag to upload into. If you want the current event's tag or branch name, use ${{ github.ref }} (the refs/tags/ and refs/heads/ prefixes will be automatically stripped).
asset_name
Filename
The name the file gets as an asset on a release. Use $tag to include the tag name. This is not used if file_glob is set to true.
file_glob
false
If set to true, the file argument can be a glob pattern (asset_name is ignored in this case).
overwrite
false
If an asset with the same name already exists, overwrite it.
check_duplicates
true
Check for existing assets with the same name. Disabling removes this validity check, and allows reduced Github API usage when there are a large number of files.
promote
false
If a prerelease already exists, promote it to a release.
draft
false
Sets the release as a draft instead of publishing it, allowing you to make any edits needed before releasing.
release_id
---
Used for searching for existing release, instead of tag. Must be used if uploading files to an existing draft release.
prerelease
false
Mark the release as a pre-release.
make_latest
true
Mark the release as the latest release for the repository.
release_name
Same as tag
Explicitly set a release name.
target_commit
Default branch (usually main)
Sets the commit hash or branch for the tag to be based on.
body
""
Content of the release text.
repo_name
Current repository
Specify the name of the GitHub repository in which the GitHub release will be created, edited, and deleted.
Output variables
browser_download_url: The publicly available URL of the asset.
release_id: The numerical ID of the created or updated release.
Usage
This usage assumes you want to build on tag creations only.
This is a common use case as you will want to upload release binaries for your tags.
Example for creating a release in a foreign repository using repo_name:
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
name: Publish binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_name: owner/repository-name
# A personal access token for the GitHub repository in which the release will be created and edited.
# It is recommended to create the access token with the following scopes: `repo, user, admin:repo_hook`.
repo_token: ${{ secrets.YOUR_PERSONAL_ACCESS_TOKEN }}
file: target/release/mything
asset_name: mything
tag: ${{ github.ref }}
overwrite: true
body: "This is my release text"
Example for feeding a file from repo to the body tag:
This example covers following points:
Reading a file present on the repo. For example, release.md which is placed in root directory of the repo.
Modify & push the release.md file before triggering this action (create tag for this example) to dynamically change the body of the release.
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
name: Publish binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# This step reads a file from repo and use it for body of the release
# This works on any self-hosted runner OS
- name: Read release.md and use it as a body of new release
id: read_release
shell: bash
run: |
r=$(cat path/to/release.md) # <--- Read release.md (Provide correct path as per your repo)
r="${r//'%'/'%25'}" # Multiline escape sequences for %
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT # <--- Set environment variable
- name: Upload Binaries to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
body: |
${{ steps.read_release.outputs.RELEASE_BODY }} # <--- Use environment variables that was created earlier
Permissions
This actions requires writes access to the release. If you are encountering "resource not accessible by integration" errors, you will need to add the contents: write permission to the token using granular permissions:
permissions:
contents: write
By default, these permissions are granted on push but not on pr - and you should be wary of adding them to workflows that run on pr, as they allow wide access to changing the entire repo's contents
Releasing
To release this Action:
Bump version in package.json
Create CHANGELOG.md entry
npm update
npm run all
git commit -am <version>
git tag -sm <version> <version>
git push --follow-tags
Go to https://github.com/svenstaro/upload-release-action/releases and publish the new version
Đọc thêm về svenstaro/upload-release-action ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/svenstaro/upload-release-action là nguồn chính thức.
svenstaro/upload-release-action có bao nhiêu sao?
svenstaro/upload-release-action có 722 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/svenstaro/upload-release-action. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
svenstaro/upload-release-action có phải mã nguồn mở không?
Có — svenstaro/upload-release-action phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/svenstaro/upload-release-action.
svenstaro/upload-release-action có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho svenstaro/upload-release-action. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
svenstaro/upload-release-action là gì?
svenstaro/upload-release-action (svenstaro/upload-release-action) là dự án TypeScript trên GitHub. Theo mô tả gốc: Upload files to a GitHub release
Đọc đầy đủ README ở tab phía trên.
upload-release-action có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về upload-release-action.