switch to new release action

This commit is contained in:
sadorowo 2024-03-20 20:53:10 +01:00
parent 31744e7e77
commit 425d28d563

View File

@ -18,48 +18,39 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Set current date as env variable
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Set current date as env variable
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
- name: Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
cache: 'gradle'
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
cache: 'gradle'
- name: Get app version
id: get_version
run: echo "version_name=$(grep -m1 "versionName" app/build.gradle | awk '{print $2}' | tr -d '\''"\'')" >> $GITHUB_ENV
- name: Get app version
id: get_version
run: echo "VERSION_NAME=$(grep -m1 "versionName" app/build.gradle | awk '{print $2}' | tr -d \''"\')" >> $GITHUB_ENV
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build Debug APK
run: ./gradlew assembleDebug
- name: Build debug APK
run: ./gradlew assembleDebug
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version_name }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Debug APK
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/build/outputs/apk/debug/*.apk
asset_name: debug-${{ env.repository_name }}-${{ env.date_today }}.apk
asset_content_type: application/vnd.android.package-archive
- name: Create release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
app/build/outputs/apk/debug/*.apk
name: Release ${{ github.ref }}
body: |
## Changes
- new version: ${{ env.VERSION_NAME }}
- date: ${{ env.date_today }}