Fix error in workflows/android #5
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: Build Android apk from Web code | |
on: | |
push: | |
branches: [ "apk" ] | |
pull_request: | |
branches: [ "apk" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Install npm dependencies | |
run: npm install | |
- name: set up JDK 19 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '19' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Create the Android project | |
run: npx cap add android | |
- name: Bump version number | |
run: npm run bump | |
- name: Build apk | |
run: npm run build-apk | |
uses: actions/upload-artifact@v1 | |
with: | |
name: apk | |
path: './android/app/build/outputs/apk/debug/app-debug.apk' | |
release: | |
name: Release APK | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download APK from build | |
uses: actions/download-artifact@v1 | |
with: | |
name: apk | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
- name: Upload Release APK | |
id: upload_release_asset | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: './android/app/build/outputs/apk/debug/app-debug.apk' | |
asset_name: hackernews-${{github.ref}}.apk | |
asset_content_type: application/zip | |