gpt4 book ai didi

android - 将来自 github 操作的 Artifact 添加到发布

转载 作者:行者123 更新时间:2023-12-04 23:45:19 28 4
gpt4 key购买 nike

所以我试图在我的 yml 文件中为生成的工件实现一个发布部分,我自己解释说:我想用我的 yml 文件在我的发布中添加一个工件。
这是正在为 android 应用程序处理的唯一 yml 文件:

name: Android CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- run: mkdir -p app/build/outputs/apk/release
- run: echo hello > app/build/outputs/apk/release/app-release-unsigned.apk
- uses: actions/upload-artifact@v2
with:
name: my-artifact
path: app/build/outputs/apk/release/app-release-unsigned.apk
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Permition Gradlew
run: chmod +x gradlew
- name: Build Gradlew
run: ./gradlew assembleRelease



最佳答案

actions/upload-artifact@v2 Action 用于将工件上传到 GitHub Actions 工作流运行,而不是用于将 Assets 添加到 GitHub 版本。如果您想将构建 Assets 添加到 GitHub 版本,您应该使用 softprops/action-gh-release示例描述 here .我已经修改了示例以匹配您的特定场景:

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project
run: |
mkdir -p app/build/outputs/apk/release
echo hello > app/build/outputs/apk/release/app-release-unsigned.apk
- name: Release with Notes
uses: softprops/action-gh-release@v1
with:
files: app/build/outputs/apk/release/app-release-unsigned.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
您可以根据需要使用不同的路径重复最后一步,以便将更多工件添加到版本中。

关于android - 将来自 github 操作的 Artifact 添加到发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65325879/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com