Repository navigation
77 lines (65 loc) · 2.19 KB
/
Copy pathmain.yml
File metadata and controls
77 lines (65 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Build and create release on merged PR to master
on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- master
jobs:
gradle:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Get version name
run: echo "VERSION_INFORMATION=$(${{github.workspace}}/gradlew -q --no-configuration-cache printVersionName)" >> $GITHUB_ENV
- name: Execute Gradle build
run: ./gradlew assembleDebug
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: apk
path: app/build/outputs/apk/debug/app-debug.apk
- name: Check for new app version
run: |
TAGS=$(git tag -l)
if echo "$TAGS" | grep -q "${{ env.VERSION_INFORMATION }}"; then
echo "This is not a new version! Exiting..."
exit 1
else
echo "New version!"
fi
- name: Create tag
id: create_tag
run: |
tag=${{ env.VERSION_INFORMATION }}
echo "::set-output name=tag::$tag"
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.tag }}
release_name: ${{ steps.create_tag.outputs.tag }}
draft: true
prerelease: false
- uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/build/outputs/apk/debug/app-debug.apk
asset_name: app-debug.apk
asset_content_type: application/apk
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}