From 265eeb623c1380a11bf1178178f6a1372149e37e Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Sun, 22 May 2022 19:02:56 +0800 Subject: [PATCH] update workflows --- .github/workflows/{reader.yml => build.yml} | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) rename .github/workflows/{reader.yml => build.yml} (83%) diff --git a/.github/workflows/reader.yml b/.github/workflows/build.yml similarity index 83% rename from .github/workflows/reader.yml rename to .github/workflows/build.yml index ca94e7e..5b6c3ed 100644 --- a/.github/workflows/reader.yml +++ b/.github/workflows/build.yml @@ -31,15 +31,13 @@ jobs: one=$(expr ${version} % 10) versionN=v$hun.$ten.$one - echo ::set-output name=create_release::"$CREATE_RELEASE" - echo ::set-output name=build_release::"$BUILD_RELEASE" + echo ::set-output name=need_create_release::"$NEED_CREATE_RELEASE" echo ::set-output name=version_name::"$versionN" - echo create_release=$CREATE_RELEASE - echo build_release=$BUILD_RELEASE + echo need_create_release=$NEED_CREATE_RELEASE echo version_name=$versionN - if [[ $CREATE_RELEASE == 'true' ]];then + if [[ $NEED_CREATE_RELEASE == 'true' ]];then echo ::set-output name=lanzou_folder_id::"1608604" echo ::set-output name=lanzou_share_url::"https://fycz.lanzoui.com/b00ngso7e" else @@ -51,7 +49,7 @@ jobs: run: | echo "开始编译打包" chmod +x gradlew - if [ ${{ steps.config.outputs.create_release }} == 'true' -o ${{ steps.config.outputs.build_release }} == 'true' ];then + if [[ ${{ steps.config.outputs.need_create_release }} == 'true' ]];then echo "进行release构建" ./gradlew assembleRelease --parallel else @@ -62,7 +60,7 @@ jobs: id: get_path run: | path="$GITHUB_WORKSPACE/app/build/outputs/apk/release" - if [ ${{ steps.config.outputs.create_release }} != 'true' -a ${{ steps.config.outputs.build_release }} != 'true' ];then + if [[ ${{ steps.config.outputs.need_create_release }} != 'true' ]];then path="$GITHUB_WORKSPACE/app/build/outputs/apk/debug" fi files=$(ls $path) @@ -88,7 +86,7 @@ jobs: echo "[$(date -u -d '+8 hour' '+%Y.%m.%d %H:%M:%S')] 分享链接: ${{ steps.config.outputs.lanzou_share_url }}" - name: Create Release id: create_release - if: ${{ steps.config.outputs.create_release == 'true' }} + if: ${{ steps.config.outputs.need_create_release == 'true' && github.ref == 'refs/heads/master' }} uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -100,7 +98,7 @@ jobs: draft: false - name: Upload Release Asset id: upload_release_asset - if: ${{ steps.config.outputs.create_release == 'true' && steps.create_release.outputs.upload_url }} + if: ${{ steps.config.outputs.need_create_release == 'true' && steps.create_release.outputs.upload_url }} uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}