Skip to content

Commit

Permalink
リリース用に最適化
Browse files Browse the repository at this point in the history
  • Loading branch information
s1204IT authored Jan 20, 2024
1 parent 39a3cac commit c901dcd
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java
uses: actions/setup-java@v4
Expand All @@ -39,16 +41,34 @@ jobs:
~/.gradle/wrapper/
key: ${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}

- name: Build with Gradle
- name: Set environments
run: |
if [[ "${{ inputs.release }}" == "true" ]] && [[ "${{ secrets.STORE_FILE }}" == "" ]]; then
{
echo "version=$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")"
echo "commit=$(echo ${{ github.sha }} | cut -c-7)"
echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})"
} >> $GITHUB_ENV
- name: Release check
if: inputs.release == 'true'
run: |
if [[ "${{ secrets.STORE_FILE }}" == "" ]]; then
echo -e "\nERROR!\n\nリリースするには、 署名鍵を設定する必要があります。\n\n"
echo "STORE_FILE: JKS形式の署名鍵をBase64でエンコードした文字列"
echo "STORE_PASSWORD: キーストアのパスワード"
echo "KEY_ALIAS: 署名のエイリアス"
echo "KEY_PASSWORD: 署名のパスワード"
exit 1
elif [[ "${{ inputs.release }}" == "true" ]]; then
fi
if git show-ref --tags --verify --quiet "refs/tags/${{ env.version }}"; then
echo -e "\nERROR!\n\n既に同じタグが存在します。\n\n"
echo "build.gradle の versionName を変更してください"
exit 1
fi
- name: Build with Gradle
run: |
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 }}"
Expand All @@ -58,12 +78,6 @@ jobs:
./gradlew assemble --no-daemon
fi
{
echo "version=$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")"
echo "commit=$(echo ${{ github.sha }} | cut -c-7)"
echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})"
} >> $GITHUB_ENV
- name: Upload APK
uses: actions/upload-artifact@v4
with:
Expand All @@ -77,4 +91,4 @@ jobs:
tag_name: v${{ env.version }}
draft: true
prerelease: false
files: app/build/outputs/apk/release/app-release.apk
files: app/build/outputs/apk/release/app-release.apk

0 comments on commit c901dcd

Please sign in to comment.