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
This commit is contained in:
Matthew Fosse 2023-12-06 06:53:26 -07:00 committed by GitHub
parent b95af3a649
commit d370c754c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,12 @@ name: PR Test Build
on: on:
pull_request: pull_request:
branches: [main] branches: [main]
workflow_dispatch:
inputs:
branch:
description: 'Branch name to build'
required: true
default: 'main'
jobs: jobs:
PR_test_build: PR_test_build:
@ -12,6 +18,14 @@ jobs:
KEY_PASS: test@cake_wallet KEY_PASS: test@cake_wallet
steps: 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 - name: Free Up GitHub Actions Ubuntu Runner Disk Space
run: | run: |
sudo rm -rf /usr/share/dotnet sudo rm -rf /usr/share/dotnet
@ -40,7 +54,7 @@ jobs:
cd /opt/android cd /opt/android
-y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install cargo-ndk 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/ cd cake_wallet/scripts/android/
./install_ndk.sh ./install_ndk.sh
source ./app_env.sh cakewallet source ./app_env.sh cakewallet
@ -141,7 +155,7 @@ jobs:
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart
- name: Rename app - 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 - name: Build
run: | run: |
@ -156,7 +170,7 @@ jobs:
# appcenter distribute release \ # appcenter distribute release \
# --group "Testers" \ # --group "Testers" \
# --file "/opt/android/cake_wallet/build/app/outputs/apk/release/app-release.apk" \ # --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 \ # --app Cake-Labs/Cake-Wallet \
# --token ${{ secrets.APP_CENTER_TOKEN }} \ # --token ${{ secrets.APP_CENTER_TOKEN }} \
# --quiet # --quiet
@ -165,7 +179,7 @@ jobs:
run: | run: |
cd /opt/android/cake_wallet/build/app/outputs/apk/release cd /opt/android/cake_wallet/build/app/outputs/apk/release
mkdir test-apk 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 - name: Upload Artifact
uses: kittaakos/upload-artifact-as-is@v0 uses: kittaakos/upload-artifact-as-is@v0
@ -179,6 +193,6 @@ jobs:
token: ${{ secrets.SLACK_APP_TOKEN }} token: ${{ secrets.SLACK_APP_TOKEN }}
path: /opt/android/cake_wallet/build/app/outputs/apk/release/app-release.apk path: /opt/android/cake_wallet/build/app/outputs/apk/release/app-release.apk
channel: ${{ secrets.SLACK_APK_CHANNEL }} channel: ${{ secrets.SLACK_APK_CHANNEL }}
title: "${{github.head_ref}}.apk" title: "${{ env.BRANCH_NAME }}.apk"
filename: ${{github.head_ref}}.apk filename: ${{ env.BRANCH_NAME }}.apk
initial_comment: ${{ github.event.head_commit.message }} initial_comment: ${{ github.event.head_commit.message }}