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
Matthew Fosse committed
Dec 6, 2023 at 06:53 UTC
d370c754c5dd39d1cb30fde643882fd106a3dad6
1 file changed
+20
-6
.github/workflows/pr_test_build.yml
+20
-6
@@ -3,6 +3,12 @@ name: PR Test Build
3
on:
4
pull_request:
5
branches: [main]
6
+ workflow_dispatch:
7
+ inputs:
8
+ branch:
9
+ description: 'Branch name to build'
10
+ required: true
11
+ default: 'main'
12
13
jobs:
14
PR_test_build:
@@ -12,6 +18,14 @@ jobs:
18
KEY_PASS: test@cake_wallet
19
20
steps:
21
+ - name: is pr
22
+ if: github.event_name == 'pull_request'
23
+ run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
24
+
25
+ - name: is not pr
26
+ if: github.event_name != 'pull_request'
27
+ run: echo "BRANCH_NAME=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
28
+
29
- name: Free Up GitHub Actions Ubuntu Runner Disk Space
30
run: |
31
sudo rm -rf /usr/share/dotnet
@@ -40,7 +54,7 @@ jobs:
54
cd /opt/android
55
-y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
56
cargo install cargo-ndk
43
- git clone https://github.com/cake-tech/cake_wallet.git --branch $GITHUB_HEAD_REF
57
+ git clone https://github.com/cake-tech/cake_wallet.git --branch ${{ env.BRANCH_NAME }}
58
cd cake_wallet/scripts/android/
59
./install_ndk.sh
60
source ./app_env.sh cakewallet
@@ -141,7 +155,7 @@ jobs:
155
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart
156
157
- name: Rename app
144
- run: echo -e "id=com.cakewallet.test\nname=$GITHUB_HEAD_REF" > /opt/android/cake_wallet/android/app.properties
158
+ run: echo -e "id=com.cakewallet.test\nname=${{ env.BRANCH_NAME }}" > /opt/android/cake_wallet/android/app.properties
159
160
- name: Build
161
run: |
@@ -156,7 +170,7 @@ jobs:
170
# appcenter distribute release \
171
# --group "Testers" \
172
# --file "/opt/android/cake_wallet/build/app/outputs/apk/release/app-release.apk" \
159
-# --release-notes ${GITHUB_HEAD_REF} \
173
+# --release-notes ${{ env.BRANCH_NAME }} \
174
# --app Cake-Labs/Cake-Wallet \
175
# --token ${{ secrets.APP_CENTER_TOKEN }} \
176
# --quiet
@@ -165,7 +179,7 @@ jobs:
179
run: |
180
cd /opt/android/cake_wallet/build/app/outputs/apk/release
181
mkdir test-apk
168
- cp app-release.apk test-apk/$GITHUB_HEAD_REF.apk
182
+ cp app-release.apk test-apk/${{env.BRANCH_NAME}}.apk
183
184
- name: Upload Artifact
185
uses: kittaakos/upload-artifact-as-is@v0
@@ -179,6 +193,6 @@ jobs:
193
token: ${{ secrets.SLACK_APP_TOKEN }}
194
path: /opt/android/cake_wallet/build/app/outputs/apk/release/app-release.apk
195
channel: ${{ secrets.SLACK_APK_CHANNEL }}
182
- title: "${{github.head_ref}}.apk"
183
- filename: ${{github.head_ref}}.apk
196
+ title: "${{ env.BRANCH_NAME }}.apk"
197
+ filename: ${{ env.BRANCH_NAME }}.apk
198
initial_comment: ${{ github.event.head_commit.message }}