简体   繁体   中英

Upload an apk file to Slack using github action

I am trying to upload an APK file to Slack using Github. My code somehow works adding a text but it doesn't really upload the actual apk file. I am building the apk file using Flutter. All I want to do is uploading an apk file and it would be also great to send a chat notification too.. but seems chat notifcation is completed but not working for uploading a file.

在此处输入图片说明

Thanks for your help in advance!

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
    

Looks like your issue might be in your path for the release-apk step. Might be worth changing it to this:

path: ${{ github.workspace }}/app/actions_builds/app-release.apk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM