Skip to content

Commit

Permalink
build(actions): Github Workflow 添加发布步骤
Browse files Browse the repository at this point in the history
为 Github Workflow 添加构建发布的步骤,每次 Push 将会发布 PreRelease,每次 Tag 将会发布 Release。
  • Loading branch information
pboymt committed Mar 21, 2023
1 parent 447bb43 commit 5a87bcb
Showing 1 changed file with 39 additions and 6 deletions.
45 changes: 39 additions & 6 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
tags:
- "v*"
workflow_dispatch:

env:
Expand All @@ -17,7 +19,6 @@ env:

jobs:
build:

runs-on: ubuntu-latest

steps:
Expand All @@ -35,9 +36,9 @@ jobs:
uses: actions/cache@v2
with:
path: ./opencv
key: opencv-for-android-${{ env.OPENCV_VERSION }}
key: ${{ runner.os }}-opencv-for-android-${{ env.OPENCV_VERSION }}
restore-keys: |
opencv-for-android-
${{ runner.os }}-opencv-for-android-
- if: ${{ steps.cache-opencv.outputs.cache-hit != 'true' }}
name: Download OpenCV4Android and extract to :opencv
Expand All @@ -55,9 +56,9 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}
key: cache-ndk-${{ env.NDK_VERSION }}
key: ${{ runner.os }}-ndk-${{ env.NDK_VERSION }}
restore-keys: |
cache-ndk-
${{ runner.os }}-ndk-
- if: ${{ steps.cache-ndk.outputs.cache-hit != 'true' }}
name: Install NDK
Expand Down Expand Up @@ -112,4 +113,36 @@ jobs:
with:
name: mapping-${{ github.sha }}
path: app/build/outputs/mapping/release/mapping.txt
retention-days: 5
retention-days: 5

- name: Publish nightly build if on master
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v1
with:
files: |
app/build/outputs/apk/release/app-arm64-v8a-release.apk
app/build/outputs/apk/release/app-x86_64-release.apk
app/build/outputs/apk/release/app-armeabi-v7a-release.apk
app/build/outputs/apk/release/app-x86-release.apk
draft: true
prerelease: true
tag_name: nightly-${{ github.sha }}
name: Nightly build for commit ${{ github.sha }}
body: Nightly build for commit ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish release if on tag
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: |
app/build/outputs/apk/release/app-arm64-v8a-release.apk
app/build/outputs/apk/release/app-x86_64-release.apk
app/build/outputs/apk/release/app-armeabi-v7a-release.apk
app/build/outputs/apk/release/app-x86-release.apk
draft: false
prerelease: false
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
body: Release ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 5a87bcb

Please sign in to comment.