update workflows

pull/22/head
fengyuecanzhu 3 years ago
parent e5fbc9024d
commit 265eeb623c
  1. 16
      .github/workflows/build.yml

@ -31,15 +31,13 @@ jobs:
one=$(expr ${version} % 10) one=$(expr ${version} % 10)
versionN=v$hun.$ten.$one versionN=v$hun.$ten.$one
echo ::set-output name=create_release::"$CREATE_RELEASE" echo ::set-output name=need_create_release::"$NEED_CREATE_RELEASE"
echo ::set-output name=build_release::"$BUILD_RELEASE"
echo ::set-output name=version_name::"$versionN" echo ::set-output name=version_name::"$versionN"
echo create_release=$CREATE_RELEASE echo need_create_release=$NEED_CREATE_RELEASE
echo build_release=$BUILD_RELEASE
echo version_name=$versionN 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_folder_id::"1608604"
echo ::set-output name=lanzou_share_url::"https://fycz.lanzoui.com/b00ngso7e" echo ::set-output name=lanzou_share_url::"https://fycz.lanzoui.com/b00ngso7e"
else else
@ -51,7 +49,7 @@ jobs:
run: | run: |
echo "开始编译打包" echo "开始编译打包"
chmod +x gradlew 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构建" echo "进行release构建"
./gradlew assembleRelease --parallel ./gradlew assembleRelease --parallel
else else
@ -62,7 +60,7 @@ jobs:
id: get_path id: get_path
run: | run: |
path="$GITHUB_WORKSPACE/app/build/outputs/apk/release" 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" path="$GITHUB_WORKSPACE/app/build/outputs/apk/debug"
fi fi
files=$(ls $path) 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 }}" echo "[$(date -u -d '+8 hour' '+%Y.%m.%d %H:%M:%S')] 分享链接: ${{ steps.config.outputs.lanzou_share_url }}"
- name: Create Release - name: Create Release
id: 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 uses: actions/create-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -100,7 +98,7 @@ jobs:
draft: false draft: false
- name: Upload Release Asset - name: Upload Release Asset
id: 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 uses: actions/upload-release-asset@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading…
Cancel
Save