From a002fc0a2f024677ff862bcf44ce2f198a80669e Mon Sep 17 00:00:00 2001 From: Uchida Kotori Date: Sun, 18 Jul 2021 17:32:27 -0400 Subject: [PATCH] update workflow --- .github/workflows/debug_build.yml | 52 ---------------------------- .github/workflows/release_apk.yml | 52 ++++++++++++++++++++++++++-- .github/workflows/update_data.yml | 57 ------------------------------- 3 files changed, 49 insertions(+), 112 deletions(-) delete mode 100644 .github/workflows/debug_build.yml delete mode 100644 .github/workflows/update_data.yml diff --git a/.github/workflows/debug_build.yml b/.github/workflows/debug_build.yml deleted file mode 100644 index 7287372..0000000 --- a/.github/workflows/debug_build.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Build Debug APK - -# Controls when the workflow will run -on: - push: - tags: - - "debug-*.*.*" - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - build: - name: Build Debug APK - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Setup Java - uses: actions/setup-java@v2 - with: - java-version: "8.x" - distribution: 'adopt' - - - name: Setup Android SDK - uses: android-actions/setup-android@v2 - - - name: Setup Flutter - uses: subosito/flutter-action@v1 - with: - channel: "stable" - flutter-version: "2.2.3" - - - name: Decoding key.properties - uses: RollyPeres/base64-to-path@v1 - with: - filePath: ${{ github.workspace }}/android/key.properties - encodedString: ${{ secrets.KEYPROP_PROD }} - - - name: Testing key.properties - run: | - sed -n 4p ./android/key.properties - wc -c ./android/key.properties - - - name: Pub Get Packages - run: flutter doctor -v && flutter pub get - - - name: Build APK - run: flutter build apk --debug - - - name: Build Release APK - run: flutter build apk --split-per-abi --release diff --git a/.github/workflows/release_apk.yml b/.github/workflows/release_apk.yml index fbfb454..da5d64d 100644 --- a/.github/workflows/release_apk.yml +++ b/.github/workflows/release_apk.yml @@ -7,17 +7,60 @@ on: push: tags: - "v*.*.*" - - # Allows you to run this workflow manually from the Actions tab + schedule: + - cron: '0 0 1,15 * *' workflow_dispatch: jobs: build: - name: Build APK + name: Update Anime Databases and Build APK runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Get Date + id: date + run: | + echo "::set-output name=date::$(date +'%Y.%m.%d')" + echo "::set-output name=short_date::$(date +'%y%m%d')" + + - name: Show Date + run: echo "${{ steps.date.outputs.date }}(${{ steps.date.outputs.short_date }})" + + - name: Parse Tag and Version + id: parse_version + run: | + sed -i -E "s/(version: [0-9]+\.[0-9]+\.)[0-9]+(\+)[0-9]+/\1${{ steps.date.outputs.short_date }}\2${{ github.run_number }}/" pubspec.yaml + TAG_NAME=v`sed -n -E "s/version: ([0-9]+\.[0-9]+\.[0-9]+)\+[0-9]+/\1/p" pubspec.yaml` + echo $TAG_NAME + echo "::set-output name=tag_name::$TAG_NAME" + + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Replace Cookies + working-directory: ./anime_db + run: | + COOKIE=`echo "${{ secrets.BILI_COOKIE }}" | base64 --decode` + sed -i -E "s/# COOKIE/${COOKIE//$'\n'/\\n}/" spy.py + + - name: Run Script + working-directory: ./anime_db + run: | + pip install requests tqdm + python spy.py + + - name: Commit + uses: EndBug/add-and-commit@v7 + with: + add: '["./assets/anime.json", "./pubspec.yaml"]' + branch: main + default_author: user_info + message: 'update data on ${{ steps.date.outputs.date }}' + tag: '${{ steps.parse_version.outputs.tag_name }}' + - name: Setup Java uses: actions/setup-java@v2 with: @@ -44,5 +87,8 @@ jobs: - name: Create Release uses: ncipollo/release-action@v1 with: + allowUpdates: true artifacts: "build/app/outputs/apk/release/*.apk" + body: "Build ${{ steps.parse_version.outputs.tag_name }}" + name: ${{ steps.parse_version.outputs.tag_name }} token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update_data.yml b/.github/workflows/update_data.yml deleted file mode 100644 index 49205b2..0000000 --- a/.github/workflows/update_data.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Update Anime Databases - -on: - schedule: - - cron: '0 0 1,15 * *' - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Get Date - id: date - run: | - echo "::set-output name=date::$(date +'%Y.%m.%d')" - echo "::set-output name=short_date::$(date +'%y%m%d')" - - - name: Show Date - run: echo "${{ steps.date.outputs.date }}(${{ steps.date.outputs.short_date }})" - - - name: Parse Tag and Version - id: parse_version - run: | - sed -i -E "s/(version: [0-9]+\.[0-9]+\.)[0-9]+(\+)[0-9]+/\1${{ steps.date.outputs.short_date }}\2${{ github.run_number }}/" pubspec.yaml - TAG_NAME=v`sed -n -E "s/version: ([0-9]+\.[0-9]+\.[0-9]+)\+[0-9]+/\1/p" pubspec.yaml` - echo $TAG_NAME - echo "::set-output name=tag_name::$TAG_NAME" - - - name: setup python - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Replace Cookies - working-directory: ./anime_db - run: | - COOKIE=`echo "${{ secrets.BILI_COOKIE }}" | base64 --decode` - sed -i -E "s/# COOKIE/${COOKIE//$'\n'/\\n}/" spy.py - - - name: Run Script - working-directory: ./anime_db - run: | - pip install requests tqdm - python spy.py - - - name: Commit - uses: EndBug/add-and-commit@v7 - with: - add: '["./assets/anime.json", "./pubspec.yaml"]' - branch: main - default_author: user_info - message: 'update data on ${{ steps.date.outputs.date }}' - tag: '${{ steps.parse_version.outputs.tag_name }}'