Skip to content

Commit 38f7ef9

Browse files
committed
Try to get permissions to run workflow
1 parent 681609d commit 38f7ef9

1 file changed

Lines changed: 24 additions & 31 deletions

File tree

.github/workflows/pre-release_on-push.yml

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@ name: Build & Pre-Release
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [ main ]
76

87
permissions:
98
contents: write
109
actions: write
1110

12-
1311
jobs:
1412
build:
1513
runs-on: ubuntu-latest
16-
1714
steps:
1815
- name: Checkout
1916
uses: actions/checkout@v4
@@ -30,9 +27,7 @@ jobs:
3027
run: |
3128
VER=$(./gradlew :app:printVersionName --console=plain | grep "VERSION_NAME" | cut -d'=' -f2 | tr -d '[:space:]')
3229
echo "versionName=$VER" >> $GITHUB_ENV
33-
echo "Detected versionName: $VER"
3430
35-
# Decode keystore
3631
- name: Decode keystore
3732
run: echo "${{ secrets.KEYSTORE_FILE_B64 }}" | base64 -d > my-release-key.jks
3833

@@ -43,47 +38,45 @@ jobs:
4338
echo "KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> $GITHUB_ENV
4439
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> $GITHUB_ENV
4540
46-
- name: Build Release APK
47-
uses: nick-fields/retry@v3
48-
with:
49-
timeout_minutes: 10
50-
max_attempts: 3
51-
command: ./gradlew assembleRelease assembleUnminifiedRelease assembleDebuggableRelease
41+
- name: Build APKs with retry
42+
run: |
43+
for i in {1..3}; do
44+
if ./gradlew assembleRelease assembleUnminifiedRelease assembleDebuggableRelease; then
45+
exit 0
46+
fi
47+
echo "Attempt $i failed, retrying..."
48+
sleep 5
49+
done
50+
exit 1
5251
53-
- name: Rename APKs with version
52+
- name: Rename APKs
5453
run: |
5554
MIN="OpenInsectId-v${{ env.versionName }}-beta-${{ github.run_number }}.apk"
5655
UNMIN="OpenInsectId-v${{ env.versionName }}-beta-${{ github.run_number }}-unminified.apk"
5756
DEBUG="OpenInsectId-v${{ env.versionName }}-beta-${{ github.run_number }}-debuggable.apk"
58-
57+
5958
mv app/build/outputs/apk/release/app-release.apk "$MIN"
6059
mv app/build/outputs/apk/unminifiedRelease/app-unminifiedRelease.apk "$UNMIN"
61-
mv app/build/outputs/apk/debuggableRelease/app-debuggableRelease.apk "$DEBUG" # FIXED: app-debuggableRelease.apk
62-
60+
mv app/build/outputs/apk/debuggableRelease/app-debuggableRelease.apk "$DEBUG"
61+
6362
echo "APK_MIN=$MIN" >> $GITHUB_ENV
6463
echo "APK_UNMIN=$UNMIN" >> $GITHUB_ENV
6564
echo "APK_DEBUG=$DEBUG" >> $GITHUB_ENV
66-
67-
68-
6965
70-
# Create tag before release
7166
- name: Create tag
7267
run: |
7368
TAG="v${{ env.versionName }}-beta-${{ github.run_number }}"
7469
git tag "$TAG"
7570
git push origin "$TAG"
76-
echo "TAG_NAME=$TAG" >> $GITHUB_ENV
7771
78-
- name: Upload pre-release
79-
uses: softprops/action-gh-release@v2
80-
with:
81-
tag_name: ${{ env.TAG_NAME }}
82-
name: "v${{ env.versionName }}-beta-${{ github.run_number }}"
83-
prerelease: true
84-
files: |
85-
${{ env.APK_MIN }}
86-
${{ env.APK_UNMIN }}
87-
${{ env.APK_DEBUG }}
72+
- name: Release APKs
73+
run: |
74+
gh release create "${{ env.TAG_NAME }}" \
75+
"${{ env.APK_MIN }}" \
76+
"${{ env.APK_UNMIN }}" \
77+
"${{ env.APK_DEBUG }}" \
78+
--title "v${{ env.versionName }}-beta-${{ github.run_number }}" \
79+
--generate-notes \
80+
--prerelease
8881
env:
8982
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)