gkd/.github/workflows/Build-Release.yml

80 lines
2.0 KiB
YAML
Raw Normal View History

2023-11-21 18:33:34 +08:00
name: Build-Release
2023-09-03 13:48:06 +08:00
on:
push:
tags:
- v*
2023-11-07 14:02:05 +08:00
env:
BUGLY_TOKEN: ${{ secrets.BUGLY_TOKEN }}
2023-09-03 13:48:06 +08:00
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
2023-09-05 20:04:08 +08:00
cache: 'gradle'
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
2023-09-03 13:48:06 +08:00
- run: chmod 777 ./gradlew
- run: ./gradlew build
2023-11-21 18:33:34 +08:00
- uses: actions/upload-artifact@v3
2023-09-03 13:48:06 +08:00
with:
2023-11-21 18:33:34 +08:00
name: outputs
path: app/build/outputs
2023-09-03 13:48:06 +08:00
release:
needs: build
permissions: write-all
runs-on: ubuntu-latest
steps:
2023-11-21 18:33:34 +08:00
- uses: actions/download-artifact@v3
2023-09-03 13:48:06 +08:00
with:
2023-11-21 18:33:34 +08:00
name: outputs
2023-11-22 20:22:43 +08:00
path: outputs
- run: ls -R
2023-09-03 13:48:06 +08:00
2023-11-21 18:33:34 +08:00
- id: create_release
2023-09-03 13:48:06 +08:00
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
2023-11-21 18:33:34 +08:00
draft: true
2023-09-03 13:48:06 +08:00
2023-11-21 18:33:34 +08:00
- uses: actions/upload-release-asset@v1
2023-09-03 13:48:06 +08:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2023-11-21 18:33:34 +08:00
asset_path: outputs/apk/release/app-release.apk
2023-10-04 18:24:09 +08:00
asset_name: gkd-${{ github.ref_name }}.apk
2023-09-03 13:48:06 +08:00
asset_content_type: application/vnd.android.package-archive
2023-11-21 18:33:34 +08:00
- run: zip -r outputs.zip outputs
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: outputs.zip
asset_name: outputs.zip
asset_content_type: application/zip