Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
automatically build using github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow578 committed Mar 29, 2021
1 parent af5bdd6 commit 76a8221
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Build-and-Publish

on:
# triggers on pushes with tag
push:
tags:
- '*.*'

jobs:
# build the apk for release
build:
runs-on: ubuntu-latest
steps:
# check out repo with submodules
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: senpai
submodules: recursive

# setup jdk 1.8
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 1.8

# make gradlew executeable
- name: Make Gradle Executable
run: chmod +x ./gradlew

# build using gradle
- name: Build with Gradle
run: ./gradlew build

# build apk
- name: Build Release APK
run: ./gradlew assembleRelease

# sign APK
- name: Sign APK
id: sign_apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}

# rename signed apk
- name: Rename Signed APK
run: mv ${{ steps.sign_apk.outputs.signedReleaseFile }} ./tenshi-content.apk

# upload artifact
- name: Upload APK Artifact
uses: actions/upload-artifact@v2
with:
name: apk-build
path: ./tenshi-content.apk

# upload the built apk to github release
upload_github:
needs: build
runs-on: ubuntu-latest
steps:
# download artifact from previous step
- name: Download APK Artifact
uses: actions/download-artifact@v2
with:
name: apk-build
path: ./

# generate apk checksum
- name: "Generate APK Checksum"
run: sha256sum ./tenshi-content.apk > tenshi-content.sha256

# add apk to release
- name: Add APK to release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body: automatic build
files: |
./tenshi-content.apk
./tenshi-content.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

44 changes: 44 additions & 0 deletions make-release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
:: automatic release using git flow release
:: usage: make-release <RELEASE_TAG>

@echo off
:: check param 1 is set
IF "%~1" == "" (
echo No RELEASE_TAG specified.
goto:eof
exit 1
)

:: user confirm
echo Will create a release %~1
pause

:: start a new release
git flow release start %~1

:: checkout release branch on submodule extension-lib
git submodule update --init --recursive --remote
pushd .\Extensions-Lib\
git checkout senpai
popd

:: pause for last- minute changes
echo.
echo pausing now. do your last- minute changes now or undo with 'git flow release delete %~1'
echo checklist:
echo [ ] Project Compiles correctly
echo [ ] Tag %~1 does not already exist
echo [ ] Switch Extensions-Lib to senpai branch (auto)
echo [ ] Set Version in build.gradle
echo [ ] WebAdapter: Constants adjusted (DEBUG_MODE false, BASE_URL set to release repo)
pause
pause

:: finish the release
git flow release finish %~1

:: push all branches
git push --all

:: push tags to remote (triggers auto- build)
git push --tags

0 comments on commit 76a8221

Please sign in to comment.