From 9a03926c1a95ef2e72f4f1c14932bfc38c9a0a69 Mon Sep 17 00:00:00 2001 From: Om Thorat <76207818+Om-Thorat@users.noreply.github.com> Date: Tue, 12 Dec 2023 12:18:16 +0530 Subject: [PATCH] [Fix] Pwa2Apk action fix --- .github/actions/pwa2Apk/Dockerfile | 11 +++++++++++ .github/actions/pwa2Apk/action.yml | 17 +++++++++++++++++ .github/actions/pwa2Apk/entrypoint.sh | 8 ++++++++ .github/workflows/build_apk.yml | 4 ++-- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/actions/pwa2Apk/Dockerfile create mode 100644 .github/actions/pwa2Apk/action.yml create mode 100644 .github/actions/pwa2Apk/entrypoint.sh diff --git a/.github/actions/pwa2Apk/Dockerfile b/.github/actions/pwa2Apk/Dockerfile new file mode 100644 index 0000000..4951fcd --- /dev/null +++ b/.github/actions/pwa2Apk/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu +USER root +COPY entrypoint.sh /entrypoint.sh +RUN apt update +RUN apt -y install curl gnupg wget unzip +RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - +RUN chmod +x /entrypoint.sh +RUN apt -y install nodejs +RUN npm install npm@latest -g +RUN npm i -g @bubblewrap/cli +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/.github/actions/pwa2Apk/action.yml b/.github/actions/pwa2Apk/action.yml new file mode 100644 index 0000000..69df27f --- /dev/null +++ b/.github/actions/pwa2Apk/action.yml @@ -0,0 +1,17 @@ +name: 'PWA to APK action' +description: 'Github Action for Converting your PWA to APK.' +branding: + icon: 'package' + color: 'orange' +inputs: + project-root-folder: + description: 'Root folder for project generated by bubblewrap-cli' + required: true +outputs: + message: + description: "Status message from build script" +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.project-root-folder }} \ No newline at end of file diff --git a/.github/actions/pwa2Apk/entrypoint.sh b/.github/actions/pwa2Apk/entrypoint.sh new file mode 100644 index 0000000..bdafbc3 --- /dev/null +++ b/.github/actions/pwa2Apk/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh -l + +echo "========================= Changing directory to $1 =========================" +cd $1 +echo "========================= Building APK, it may take 3-4 minutes or more =========================" +( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | bubblewrap build --skipPwaValidation --skipSigning +cp ./*.apk .. +echo "========================= APK building finished =========================" \ No newline at end of file diff --git a/.github/workflows/build_apk.yml b/.github/workflows/build_apk.yml index c5d80da..e8fc72f 100644 --- a/.github/workflows/build_apk.yml +++ b/.github/workflows/build_apk.yml @@ -8,8 +8,8 @@ jobs: - name: Checkout uses: actions/checkout@v2 # Running PWA to apk action for apk generation - - name: Running PWA to APK action - uses: sharadcodes/pwa-to-apk-action@v1.0.0 + - name: Running PWA2Apk + uses: ./.github/actions/pwa2Apk with: project-root-folder: "." # This one below is a seperate action which I'm using for releasing apk