Browse Source

Configure automated build and release

master
kyori19 2 years ago
parent
commit
d35b0443de
  1. 106
      .github/workflows/build.yml
  2. 38
      .github/workflows/release.yml
  3. 23
      .github/workflows/test.yml
  4. 1
      .gitignore
  5. 2
      changelogs/v3.7.0/whatsnew-ja-JP

106
.github/workflows/build.yml

@ -0,0 +1,106 @@
name: Build
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- run: |
chmod +x ./gradlew
./gradlew :app:testBlueDebugUnitTest
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- run: |
chmod +x ./gradlew
./gradlew :app:assembleBlueRelease
- uses: r0adkll/sign-android-release@v1
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
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/create-release@v1
id: draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.CHANGELOG_VERSION }}
release_name: Yuito ${{ env.CHANGELOG_VERSION }}
body_path: ${{ env.CHANGELOG_DIR }}whatsnew-ja-JP
draft: true
- uses: actions/download-artifact@v1
with:
name: built-app
- run: |
cd ./built-app
echo "ARTIFACT_FILE=$(find . -type f -name "*.apk" | head -1 | gawk -F/ '{print $NF}')" >> $GITHUB_ENV
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft.outputs.upload_url }}
asset_path: ./built-app/${{ env.ARTIFACT_FILE }}
asset_name: Yuito-${{ env.CHANGELOG_VERSION }}.apk
asset_content_type: application/vnd.android.package-archive

38
.github/workflows/release.yml

@ -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: 1.8
- run: |
chmod +x ./gradlew
./gradlew :app:bundleBlueRelease
- uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/bundle/blue/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: net.accelf.yuito
releaseFile: ${{ env.SIGNED_RELEASE_FILE }}
track: production
whatsNewDirectory: changelogs/${{ github.event.release.tag_name }}

23
.github/workflows/test.yml

@ -1,23 +0,0 @@
name: test
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Run JUnit Test
run: ./gradlew :app:testBlueDebugUnitTest

1
.gitignore

@ -11,4 +11,3 @@ app/green
app/blue
app/src/main/gen
lib/
tuskyex_kyori.jks

2
changelogs/v3.7.0/whatsnew-ja-JP

@ -0,0 +1,2 @@
* (本家に)お知らせ機能実装(してきた)
* https://github.com/tuskyapp/Tusky/compare/17b7abb537d8214fac4b16c26c8c32ad7c3aed1e...fef4b8b07f6453b1c39715e23d23dc93b1bccb21
Loading…
Cancel
Save