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