github-actions - 如何从 github 操作下载构建文件?
问题描述
我想知道如何从 Github Actions 下载构建文件。所以主要问题是,我是 Windows 用户,我想为 mac 用户构建我的应用程序。但是没有简单的方法,所以我使用 Github Actions 为 mac 用户构建应用程序。它运行成功,但我如何下载构建文件。 链接到 Github 存储库
解决方案
构建后,您应该首先使用actions/upload-release-asset
GitHub Action 上传刚刚构建的发布资产。
您在Yevhenii Babichenko的“使用 GitHub Actions 的自动化多平台发布”中有一个完整的示例
# ...
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 后,您才可以考虑下载它们。
推荐阅读
- java - 如何在实现屏幕录制时隐藏按钮或 textView
- rust - 互斥锁下结构不相交字段的多次借用
- python - 传递无限重复数据集时,您必须指定 `steps_per_epoch` 参数
- graphql - Apollo 客户端是否缓存 React 中的嵌套对象?
- .net - 仅当文件不存在时才使用 PowerShell 从 SFTP 服务器传输文件
- d3.js - 字符串 x 刻度不缩放 D3 中的数据
- ios - WCSession 激活会话不调用委托方法
- javascript - 在函数中作为参数传递时无法设置 css 样式
- python - 我得到一个 IndexError: list index out of range 错误
- pandas - Zulu 格式的时间戳字符串到日期时间