Skip to content

Commit

Permalink
ワークフローを最適化
Browse files Browse the repository at this point in the history
Signed-off-by: Syuugo <pub@s1204.me>
  • Loading branch information
s1204IT authored Apr 23, 2024
1 parent 0bb6f25 commit de8360f
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit de8360f

Please sign in to comment.