Merge pull request #887 from VinylMusicPlayer/tools-upgrade #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GithubActions CI | |
on: [push, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: wrapper | |
- name: Merge feature branches | |
if: (github.ref == 'refs/heads/cont-integ') | |
run: ./script/merge-feature-branches | |
- name: Build the credits page | |
if: (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/')) | |
run: ./script/build-credits-page | |
- name: Build the licenses page | |
if: (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/')) | |
run: ./script/build-licenses-page | |
- name: Build CI application | |
if: (!contains(github.ref, 'refs/tags/')) | |
run: ./script/build-release | |
env: | |
KEYSTORE_PROPERTIES: ${{secrets.KEYSTORE_PROPERTIES}} | |
STORE_FILE: ${{secrets.STORE_FILE}} | |
GRADLEW_COMMAND: assembleCiRelease | |
- name: Build Play Store application | |
if: (contains(github.ref, 'refs/tags/')) | |
run: ./script/build-release | |
env: | |
KEYSTORE_PROPERTIES: ${{secrets.KEYSTORE_PROPERTIES}} | |
STORE_FILE: ${{secrets.STORE_FILE}} | |
GRADLEW_COMMAND: assemblePlayStoreRelease | |
- name: Archive APKs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: outputs-apk | |
path: app/build/outputs/apk/**/*.apk | |
- name: Run tests | |
run: ./gradlew testCiRelease | |
if: (!contains(github.ref, 'refs/tags/')) | |
- name: Archive test results | |
if: (!contains(github.ref, 'refs/tags/')) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: outputs-tests | |
path: app/build/test-results | |
- name: Static analysis | |
run: ./gradlew lint | |
if: (!contains(github.ref, 'refs/tags/')) | |
- name: Archive lint results | |
if: (!contains(github.ref, 'refs/tags/')) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: outputs-lint | |
path: app/build/reports/lint-* | |
publish: | |
if: (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/')) | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Needed to manipulate tags | |
steps: | |
- name: Retrieve built assets | |
uses: actions/download-artifact@v3 | |
with: | |
name: outputs-apk | |
path: app/build/outputs/apk | |
- name: Publish pre-release assets | |
# Pre-release the built apps and expose it via a static and public accessible URL | |
# Note that this step exists since artifacts (actions/upload-artifact) are neither | |
# public-accessible nor at a constant/static URL | |
# For the pre-releasing purpose, a floating tag is used and re-positioned to the tip of the branch | |
if: (github.ref == 'refs/heads/master') | |
uses: pyTooling/Actions/releaser@r0 | |
with: | |
tag: pre-release | |
token: ${{ secrets.GITHUB_TOKEN }} | |
rm: true # clean past assets | |
files: | | |
app/build/outputs/apk/ci/release/*.apk | |
- name: Release to Play Store | |
# TODO Dont publish to PlayStore any tag, must follow M.m.u convention | |
if: (contains(github.ref, 'refs/tags/') && !contains(github.ref, 'refs/tags/pre-release')) | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT}} | |
packageName: com.poupa.vinylmusicplayer | |
releaseName: ${{ github.ref_name }} | |
track: production | |
releaseFiles: app/build/outputs/apk/playStore/release/*.apk |