Skip to content

Commit de7c0ac

Browse files
committed
branch
1 parent 58f0b1f commit de7c0ac

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

.github/workflows/gradle.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ name: CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches:
6+
- master
7+
- classic
68
tags:
79
- v*.*.*
810
pull_request:
9-
branches: [ master ]
11+
branches:
12+
- master
13+
- classic
1014
paths-ignore:
1115
- '**.md'
1216
- '**.txt'
@@ -29,6 +33,7 @@ jobs:
2933
build:
3034
name: Build apk
3135
runs-on: ubuntu-24.04
36+
3237
steps:
3338
- name: Clone repo
3439
uses: actions/checkout@v4
@@ -48,19 +53,31 @@ jobs:
4853
- name: Grant execute permission for gradlew
4954
run: chmod +x gradlew
5055

56+
- name: Detect branch
57+
if: github.ref_type == 'branch'
58+
run: |
59+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
60+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
61+
62+
if [ "$BRANCH_NAME" = "master" ]; then
63+
echo "APK_SUFFIX=master" >> $GITHUB_ENV
64+
elif [ "$BRANCH_NAME" = "classic" ]; then
65+
echo "APK_SUFFIX=classic" >> $GITHUB_ENV
66+
fi
67+
5168
- name: Build debug apk
69+
if: github.ref_type == 'branch'
5270
run: ./gradlew assembleDebug
5371

54-
- name: Upload artifact
55-
if: ${{ !github.head_ref }}
72+
- name: Upload debug artifact
73+
if: github.ref_type == 'branch'
5674
uses: actions/upload-artifact@v4
5775
with:
58-
name: apk-debug
76+
name: apk-debug-${{ env.APK_SUFFIX }}
5977
path: app/build/outputs/apk/debug
6078

6179
- name: Get tag name
6280
if: startsWith(github.ref, 'refs/tags/') && github.repository == env.ORIGINAL_PROJECT
63-
id: get_tag_name
6481
run: |
6582
set -x
6683
version_tag=${GITHUB_REF/refs\/tags\//}
@@ -76,7 +93,7 @@ jobs:
7693
if: startsWith(github.ref, 'refs/tags/') && github.repository == env.ORIGINAL_PROJECT
7794
run: |
7895
cp app/build/outputs/apk/release/app-release.apk app-release.apk
79-
cp app-release.apk PixShaft_$VERSION_TAG_SHORT.apk
96+
cp app-release.apk PixShaft_${VERSION_TAG_SHORT}.apk
8097
sha1=`sha1sum app-release.apk | awk '{ print toupper($1) }'`
8198
sha256=`sha256sum app-release.apk | awk '{ print toupper($1) }'`
8299
echo "APK_SHA1=$sha1" >> $GITHUB_ENV
@@ -105,7 +122,7 @@ jobs:
105122
SHA-256: ${{ env.APK_SHA256 }}
106123
```
107124
files: |
108-
PixShaft_${{env.VERSION_TAG_SHORT}}.apk
125+
PixShaft_${{ env.VERSION_TAG_SHORT }}.apk
109126
draft: true
110127
prerelease: false
111128
env:

0 commit comments

Comments
 (0)