From de8360f35685d04e5d929622c8f9cf695141c62d Mon Sep 17 00:00:00 2001 From: Syuugo Date: Tue, 23 Apr 2024 14:48:52 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AF=E3=83=BC=E3=82=AF=E3=83=95=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=82=92=E6=9C=80=E9=81=A9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Syuugo --- .github/workflows/build.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5f7f9f..8784121 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,12 +39,13 @@ jobs: path: | ~/.gradle/caches/ ~/.gradle/wrapper/ + ./.gradle/ key: ${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - name: Set environments run: | { - echo "version=v$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")" + echo "version=v$(grep -oP 'versionName "\K[^"]+' app/build.gradle)" echo "commit=$(echo ${{ github.sha }} | cut -c-7)" echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})" } >> $GITHUB_ENV @@ -59,36 +60,34 @@ jobs: - name: Release check if: github.event.inputs.release == 'true' run: | - if [[ "${{ secrets.STORE_FILE }}" == "" ]]; then - echo -e "\nERROR!\nリリースするには、 署名鍵を設定する必要があります。\n" - echo "STORE_FILE: JKS形式の署名鍵をBase64でエンコードした文字列" - echo "STORE_PASSWORD: キーストアのパスワード" - echo "KEY_ALIAS: 署名のエイリアス" - echo "KEY_PASSWORD: 署名のパスワード" + if [ "${{ secrets.STORE_FILE }}" == "" ]; then + echo -e "\nERROR!\nTo release, you need to set up a signing key! \n" + echo "STORE_FILE: A Base64 encoded string of the signing key in JKS format" + echo "STORE_PASSWORD: Key store password" + echo "KEY_ALIAS: Key alias" + echo "KEY_PASSWORD: Key password" echo "" exit 1 fi - if [[ "${{ steps.check-tag.outputs.exists }}" == "true" ]]; then - echo -e "\nERROR!\n既に同じタグが存在します。\n" - echo "build.gradle の versionName を変更してください" + if [ "${{ steps.check-tag.outputs.exists }}" == "true" ]; then + echo -e "\nERROR!\nThe same tag already exists!\n" + echo "Please change versionName in build.gradle" echo "" exit 1 fi - name: Build with Gradle run: | - if [[ "${{ inputs.release }}" == "true" ]]; then + if [ "${{ inputs.release }}" == "true" ]; then echo "${{ secrets.STORE_FILE }}" | base64 -d > app/release.jks export STORE_PASSWORD="${{ secrets.STORE_PASSWORD }}" export KEY_ALIAS="${{ secrets.KEY_ALIAS }}" export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}" - ./gradlew aR - ./gradlew bR + ./gradlew aR bR cp -f app/build/outputs/apk/release/app-release.apk ${{ env.repo }}-${{ env.version }}.apk cp -f app/build/outputs/bundle/release/app-release.aab ${{ env.repo }}-${{ env.version }}.aab else - ./gradlew asD - ./gradlew bunD + ./gradlew asD bunD cp -f app/build/outputs/apk/debug/app-debug.apk ${{ env.repo }}-${{ env.version }}@${{ env.commit }}.apk cp -f app/build/outputs/bundle/debug/app-debug.aab ${{ env.repo }}-${{ env.version }}@${{ env.commit }}.aab fi