Skip to content

add fetch depth

add fetch depth #140

Workflow file for this run

name: Build APK and Notify Discord
on:
push:
branches:
- dev
paths-ignore:
- '**/README.md'
jobs:
build:
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 10
- name: Get Last 10 Commits
id: get_commits
run: |
echo 'COMMIT_LOG<<EOF' >> $GITHUB_ENV
git log ${{ github.event.before }}..${{ github.sha }} --pretty=format:"%s" -10 >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Set variables
run: |
VER=$(grep -E -o "versionName \".*\"" app/build.gradle | sed -e 's/versionName //g' | tr -d '"')
SHA=${{ github.sha }}
VERSION="$VER+${SHA:0:7}"
echo "Version $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: gradle
- name: Decode Keystore File
run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > $GITHUB_WORKSPACE/key.keystore
- name: List files in the directory
run: ls -l
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew assembleAlpha -Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/key.keystore -Pandroid.injected.signing.store.password=${{ secrets.KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.KEY_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.KEY_PASSWORD }}
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: Dantotsu
path: "app/build/outputs/apk/alpha/app-alpha.apk"
- name: Upload APK to Discord
shell: bash
run: |
commit_messages=$(echo "$COMMIT_LOG")
contentbody=$( jq -Rsa . <<< "Alpha-Build: <@659107544597266465> **${{ env.VERSION }}**\n\n$commit_messages" )
curl -F "payload_json={\"content\":${contentbody}}" -F "dantotsu_debug=@app/build/outputs/apk/alpha/app-alpha.apk" ${{ secrets.DISCORD_WEBHOOK }}
- name: Delete Old Pre-Releases
id: delete-pre-releases
uses: sgpublic/delete-release-action@master
with:
pre-release-drop: true
pre-release-keep-count: 3
pre-release-drop-tag: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}