From d370c754c5dd39d1cb30fde643882fd106a3dad6 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Wed, 6 Dec 2023 06:53:26 -0700 Subject: [PATCH] allow manual builds on any branch (#1219) * allow manual builds on any branch * small fix * see if this works * test fix * test fix * fix * fix * test * fix * fix * consistent variable naming --- .github/workflows/pr_test_build.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 8fef4fdb6..5b2bb11d3 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -3,6 +3,12 @@ name: PR Test Build on: pull_request: branches: [main] + workflow_dispatch: + inputs: + branch: + description: 'Branch name to build' + required: true + default: 'main' jobs: PR_test_build: @@ -12,6 +18,14 @@ jobs: KEY_PASS: test@cake_wallet steps: + - name: is pr + if: github.event_name == 'pull_request' + run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV + + - name: is not pr + if: github.event_name != 'pull_request' + run: echo "BRANCH_NAME=${{ github.event.inputs.branch }}" >> $GITHUB_ENV + - name: Free Up GitHub Actions Ubuntu Runner Disk Space run: | sudo rm -rf /usr/share/dotnet @@ -40,7 +54,7 @@ jobs: cd /opt/android -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh cargo install cargo-ndk - git clone https://github.com/cake-tech/cake_wallet.git --branch $GITHUB_HEAD_REF + git clone https://github.com/cake-tech/cake_wallet.git --branch ${{ env.BRANCH_NAME }} cd cake_wallet/scripts/android/ ./install_ndk.sh source ./app_env.sh cakewallet @@ -141,7 +155,7 @@ jobs: echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart - name: Rename app - run: echo -e "id=com.cakewallet.test\nname=$GITHUB_HEAD_REF" > /opt/android/cake_wallet/android/app.properties + run: echo -e "id=com.cakewallet.test\nname=${{ env.BRANCH_NAME }}" > /opt/android/cake_wallet/android/app.properties - name: Build run: | @@ -156,7 +170,7 @@ jobs: # appcenter distribute release \ # --group "Testers" \ # --file "/opt/android/cake_wallet/build/app/outputs/apk/release/app-release.apk" \ -# --release-notes ${GITHUB_HEAD_REF} \ +# --release-notes ${{ env.BRANCH_NAME }} \ # --app Cake-Labs/Cake-Wallet \ # --token ${{ secrets.APP_CENTER_TOKEN }} \ # --quiet @@ -165,7 +179,7 @@ jobs: run: | cd /opt/android/cake_wallet/build/app/outputs/apk/release mkdir test-apk - cp app-release.apk test-apk/$GITHUB_HEAD_REF.apk + cp app-release.apk test-apk/${{env.BRANCH_NAME}}.apk - name: Upload Artifact uses: kittaakos/upload-artifact-as-is@v0 @@ -179,6 +193,6 @@ jobs: token: ${{ secrets.SLACK_APP_TOKEN }} path: /opt/android/cake_wallet/build/app/outputs/apk/release/app-release.apk channel: ${{ secrets.SLACK_APK_CHANNEL }} - title: "${{github.head_ref}}.apk" - filename: ${{github.head_ref}}.apk + title: "${{ env.BRANCH_NAME }}.apk" + filename: ${{ env.BRANCH_NAME }}.apk initial_comment: ${{ github.event.head_commit.message }}