gkd/.github/workflows/Build-Release.yml
2024-07-16 20:29:47 +08:00

113 lines
3.3 KiB
YAML

name: Build-Release
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: write secrets info
run: |
echo ${{ secrets.GKD_STORE_FILE_BASE64 }} | base64 --decode > ${{ github.workspace }}/key.jks
echo GKD_STORE_FILE='${{ github.workspace }}/key.jks' >> gradle.properties
echo GKD_STORE_PASSWORD='${{ secrets.GKD_STORE_PASSWORD }}' >> gradle.properties
echo GKD_KEY_ALIAS='${{ secrets.GKD_KEY_ALIAS }}' >> gradle.properties
echo GKD_KEY_PASSWORD='${{ secrets.GKD_KEY_PASSWORD }}' >> gradle.properties
- run: chmod 777 ./gradlew
- run: ./gradlew app:assemble
- uses: actions/upload-artifact@v4
with:
name: outputs
path: app/build/outputs
- uses: actions/upload-artifact@v4
with:
name: default-debug
path: app/build/outputs/apk/default/debug
- uses: actions/upload-artifact@v4
with:
name: default-release
path: app/build/outputs/apk/default/release
- uses: actions/upload-artifact@v4
with:
name: fdroid-debug
path: app/build/outputs/apk/fdroid/debug
- uses: actions/upload-artifact@v4
with:
name: fdroid-release
path: app/build/outputs/apk/fdroid/release
- uses: actions/upload-artifact@v4
with:
name: CHANGELOG.md
path: CHANGELOG.md
release:
needs: build
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: outputs
path: outputs
- uses: actions/download-artifact@v4
with:
name: CHANGELOG.md
- run: ls -R
- id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: ./CHANGELOG.md
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: outputs/apk/default/release/app-default-release.apk
asset_name: gkd-${{ github.ref_name }}.apk
asset_content_type: application/vnd.android.package-archive
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: outputs/apk/fdroid/release/app-fdroid-release.apk
asset_name: gkd-fdroid-${{ github.ref_name }}.apk
asset_content_type: application/vnd.android.package-archive
- 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-${{ github.ref_name }}.zip
asset_content_type: application/zip