使用 github 操作将 apk 文件上传到 Slack
Posted
技术标签:
【中文标题】使用 github 操作将 apk 文件上传到 Slack【英文标题】:Upload an apk file to Slack using github action 【发布时间】:2021-12-18 14:35:16 【问题描述】:我正在尝试使用 Github 将 APK 文件上传到 Slack。我的代码以某种方式添加了文本,但它并没有真正上传实际的 apk 文件。我正在使用 Flutter 构建 apk 文件。我想要做的就是上传一个apk文件,发送一个聊天通知也很好..但似乎聊天通知已完成但无法上传文件。
提前感谢您的帮助!
name: APK Deploy
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
# Setup Java environment in order to build the android app.
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
# Setup the flutter environment.
- uses: subosito/flutter-action@v1
with:
channel: 'stable' # 'dev', 'alpha', default to: 'stable'
# flutter-version: '1.12.x' # you can also specify exact version of flutter
# Get flutter dependencies.
- run: flutter pub get
# Statically analyze the Dart code for any errors.
- run: flutter analyze .
# Run widget tests for our flutter project.
- run: flutter test
# Build apk.
- run: flutter build apk --release
- run: 'echo build/app/outputs/apk/release/app-release.apk > app-release.apk'
- uses: MeilCli/slack-upload-file@v1
with:
slack_token: $ secrets.SLACK_READ_WRITE_TOKEN
channels: $ secrets.SLACK_CHANNEL_DEPLOY
file_path: 'build/app/outputs/apk/release/app-release.apk'
file_name: 'app-release.apk'
file_type: 'apk'
initial_comment: '$ github.ref - deployed the apk file to slack'
- name: action-slack
uses: 8398a7/action-slack@v3.8.0
with:
status: $ job.status
author_name: Build Notification
env:
SLACK_WEBHOOK_URL: $ secrets.SLACK_WEBHOOK_URL
# Upload generated apk to the artifacts.
- name: release-apk
uses: actions/upload-artifact@v2
with:
name: app-release.apk
path: build/app/outputs/apk/release/app-release.apk
【问题讨论】:
【参考方案1】:看起来您的问题可能在您的 release-apk 步骤中。可能值得将其更改为:
path: $ github.workspace /app/actions_builds/app-release.apk
【讨论】:
以上是关于使用 github 操作将 apk 文件上传到 Slack的主要内容,如果未能解决你的问题,请参考以下文章