【发布时间】:2020-12-15 16:28:46
【问题描述】:
我想知道如何从 Github Actions 下载构建文件。 所以主要问题是,我是 Windows 用户,我想为 mac 用户构建我的应用程序。但是没有简单的方法,所以我使用 Github Actions 为 mac 用户构建应用程序。它运行成功,但我怎样才能下载构建文件。 Link to the Github Repo
【问题讨论】:
标签: github-actions
我想知道如何从 Github Actions 下载构建文件。 所以主要问题是,我是 Windows 用户,我想为 mac 用户构建我的应用程序。但是没有简单的方法,所以我使用 Github Actions 为 mac 用户构建应用程序。它运行成功,但我怎样才能下载构建文件。 Link to the Github Repo
【问题讨论】:
标签: github-actions
一旦构建完成,您应该首先使用actions/upload-release-asset GitHub Action 上传您刚刚构建的发布资产。
您在“Automated multi-platform releases with GitHub Actions ”中有一个来自Yevhenii Babichenko的完整示例
# ...
release_assets:
name: Release assets
needs: create_release # we need to know the upload URL
runs-on: ${{ matrix.config.os }} # we run many different builds
strategy:
# just an example matrix
matrix:
config:
- os: ubuntu-latest
- os: macos-latest
- os: windows-latest
steps:
# checkout of cource
- name: Checkout code
uses: actions/checkout@v1
# ... whatever build and packaging steps you need here
# and finally do an upload!
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
# This is how it will be named on the release page. Put hatever name
# you like, remember that they need to be different for each platform.
# You can choose any build matrix parameters. For Rust I use the
# target triple.
asset_name: program-name-${{ matrix.config.os }}
# The path to the file you want to upload.
asset_path: ./path/to/your/file
# probably you will need to change it, but most likely you are
# uploading a binary file
asset_content_type: application/octet-stream
只有当这些资产上传到 GitHub 时,才可以考虑downloading them。
【讨论】: