Skip to content

Commit

Permalink
ci: add github actions workflow for building streamely app
Browse files Browse the repository at this point in the history
  • Loading branch information
elyeandre committed Jul 25, 2024
1 parent e377d6c commit a3e98d4
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
75 changes: 75 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build Streamely App

on:
workflow_dispatch:
repository_dispatch:
types: [build-project]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '17'

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- name: Cache Gradle files
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Install Cordova
run: npm install -g cordova

- name: Add Android platform
run: cordova platform add android

- name: Install app dependencies
run: npm install

- name: Restore Release Keystore
run: |
echo "${{ secrets.STREAMELY_RELEASE_KEY }}" > streamely.release-key.asc
gpg -d --passphrase "${{ secrets.STREAMELY_RELEASE_PASSPHRASE }}" --batch streamely.release-key.asc > streamely-release-key.jks
- name: Build release APK
run: cordova build android --release -- --packageType=apk --keystore=streamely-release-key.jks --storePassword=${{ secrets.KEYSTORE_PASSWORD }} --alias=${{ secrets.KEY_ALIAS }} --password=${{ secrets.KEY_PASSWORD }}

- name: Upload release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.client_payload.upload_url }}
asset_path: platforms/android/app/build/outputs/apk/release/app-release.apk
asset_name: streamely-v${{ github.event.client_payload.tag_name }}.apk
asset_content_type: application/vnd.android.package-archive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
if: ${{ steps.release.outputs.release_created }}
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.MY_PAT }}
token: ${{ secrets.PAT_TOKEN }}
repository: elyeandre/streamely-native-app
event-type: build-project
client-payload: '{"upload_url": "${{ steps.release.outputs.upload_url }}", "tag_name": "${{ steps.release.outputs.tag_name }}" }'

0 comments on commit a3e98d4

Please sign in to comment.