[ci] Use GitHub Actions for build/release

This commit is contained in:
kyori19 2023-06-10 01:22:11 +09:00
parent 8f86c6d4a6
commit fdba275baa
No known key found for this signature in database
GPG Key ID: F7BDE7DD42BF366A
3 changed files with 141 additions and 140 deletions

103
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,103 @@
name: Build
permissions:
contents: write
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
- run: |
chmod +x ./gradlew
./gradlew :ktlintCheck
./gradlew :app:testBlueDebugUnitTest
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
- run: |
chmod +x ./gradlew
./gradlew :app:assembleBlueRelease
- uses: r0adkll/sign-android-release@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
releaseDirectory: app/build/outputs/apk/blue/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- uses: actions/upload-artifact@v2
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
name: built-app
path: ${{ env.SIGNED_RELEASE_FILE }}
draft:
runs-on: ubuntu-latest
needs: [test, build]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
| tr '\r\n' ' ' \
| jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' \
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{}
- run: |
DIR_TIMESTAMP=$(git log -1 --pretty="format:%ct" ./changelogs/)
for d in ./changelogs/*/; do
if [ $(git log -1 --pretty="format:%ct" "$d") = $DIR_TIMESTAMP ]; then
echo "CHANGELOG_DIR=$d" >> $GITHUB_ENV
echo "CHANGELOG_VERSION=$(basename -as / "$d")" >> $GITHUB_ENV
fi
done
- uses: actions/download-artifact@v1
with:
name: built-app
- run: |
cd ./built-app
mv "$(find . -type f -name "*.apk" | head -1)" "Yuito-${{ env.CHANGELOG_VERSION }}.apk"
- uses: ncipollo/release-action@v1
with:
allowUpdates: false
artifactErrorsFailBuild: true
artifacts: ./built-app/Yuito-${{ env.CHANGELOG_VERSION }}.apk
bodyFile: ${{ env.CHANGELOG_DIR }}whatsnew-en-US
draft: true
name: Yuito ${{ env.CHANGELOG_VERSION }}
tag: ${{ env.CHANGELOG_VERSION }}

38
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Release
on:
release:
types: [released]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
- run: |
chmod +x ./gradlew
./gradlew :app:bundleBlueRelease
- uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/bundle/blueRelease
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- uses: r0adkll/upload-google-play@v1.0.17
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: net.accelf.yuito
releaseFile: ${{ env.SIGNED_RELEASE_FILE }}
track: production
whatsNewDirectory: changelogs/${{ github.event.release.tag_name }}

View File

@ -1,140 +0,0 @@
format_version: "6"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
trigger_map:
- push_branch: develop
workflow: nightly
- pull_request_source_branch: '*'
workflow: primary
- tag: '*'
workflow: release
workflows:
nightly:
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@8.0: {}
- cache-pull@2.7: {}
- install-missing-android-tools:
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
- change-android-versioncode-and-versionname@1.3: {}
- gradle-runner@2:
inputs:
- apk_file_include_filter: '*.aab'
- gradlew_path: ./gradlew
- gradle_options: ""
- gradle_task: ktlintCheck lintGreenDebug testGreenReleaseUnitTest bundleGreenRelease
- sign-apk@1:
inputs:
- apk_path: $BITRISE_AAB_PATH
- script:
inputs:
- content: |
#!/usr/bin/env bash
# write the git log to a file for the deploy step to pick up
git log -3 --pretty=%B | head -c 500 > whatsnew-en-US
- google-play-deploy@3.7:
inputs:
- apk_path: $BITRISE_SIGNED_APK_PATH
- package_name: com.keylesspalace.tusky.test
- track: production
- app_path: $BITRISE_SIGNED_AAB_PATH
- whatsnews_dir: ./
- service_account_json_key_path: $TUSKY_SERVICE_ACC_URL
- deploy-to-bitrise-io@2.1: {}
- cache-push@2.7: {}
primary:
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone: {}
- cache-pull@2.7: {}
- install-missing-android-tools:
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
- gradle-runner@2:
inputs:
- app_file_include_filter: |-
*.apk
*.aab
- app_file_exclude_filter: |2+
- test_apk_file_include_filter: ""
- mapping_file_include_filter: ""
- retry_on_failure: "no"
- gradlew_path: ./gradlew
- gradle_options: --no-daemon
- gradle_task: ktlintCheck lintGreenDebug
- android-unit-test@1.0:
inputs:
- project_location: $PROJECT_LOCATION
- module: app
- variant: greenDebug
- android-build:
inputs:
- variant: greenDebug
- module: app
- deploy-to-bitrise-io@2.1:
inputs:
- debug_mode: "true"
- notify_user_groups: none
- cache-push@2.7: {}
release:
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone: {}
- cache-pull@2.7: {}
- install-missing-android-tools@3.1:
inputs:
- gradlew_path: $PROJECT_LOCATION/gradlew
- gradle-runner@2.0:
inputs:
- apk_file_include_filter: ""
- gradlew_path: ./gradlew
- gradle_task: assembleBlueRelease bundleBlueRelease
- sign-apk:
inputs:
- debuggable_permitted: "false"
- keystore_alias: $TUSKY_RELEASE_KEY_NAME
- private_key_password: $TUSKY_RELEASE_KEY_PASSWORD
- verbose_log: "true"
- android_app: $BITRISE_APK_PATH|$BITRISE_AAB_PATH
- apk_path: ""
- deploy-to-bitrise-io@2.1:
inputs:
- generate_universal_apk_if_none: "false"
- script@1:
inputs:
- content: |
#!/usr/bin/env bash
# find the newest english changelog, write it to a file for the deploy step to pick up
changelog_file=$(ls -1 fastlane/metadata/android/en-US/changelogs | sort -V -r | head -n 1)
cat fastlane/metadata/android/en-US/changelogs/$changelog_file >> whatsnew-en-US
- google-play-deploy@3:
inputs:
- app_path: $BITRISE_AAB_PATH
- track: internal
- service_account_json_key_path: $TUSKY_SERVICE_ACC_URL
- package_name: com.keylesspalace.tusky
- cache-push@2.7: {}
app:
envs:
- opts:
is_expand: false
PROJECT_LOCATION: .
- opts:
is_expand: false
MODULE: app
- opts:
is_expand: false
BUILD_VARIANT: GreenDebug
- opts:
is_expand: false
TEST_VARIANT: GreenDebug
meta:
bitrise.io:
stack: linux-docker-android-20.04