-
Notifications
You must be signed in to change notification settings - Fork 169
135 lines (127 loc) · 4.97 KB
/
android.yml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Android CI
env:
# The name of the main module repository
main_project_module: app
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # for deleting/creating a pre-release
steps:
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
cache: gradle
- uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.5
- name: Create base64 jks file
run: echo "${{ secrets.BASE_64_SIGNING_KEY }}" > app/release_keystore.txt
- name: Create jks file
run: base64 -d "app/release_keystore.txt" > app/release_keystore.jks
- name: Create Blank Local Properties FIle
run: touch local.properties
- name: Create Keystore Properties File
run: echo "${{ secrets.LOCAL_PROPERTIES }}" > keystore.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Set current date as env variable
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
# Create APK Debug
- name: Build apk debug project (APK)
run: ./gradlew assembleDebug
# Create APK Release
- name: Build apk release project (APK)
run: ./gradlew assemble
# Upload Artifact Build
# Noted For Output [main_project_module]/build/outputs/apk/debug/
- name: Upload APK Debug
uses: actions/upload-artifact@v3
with:
name: YTDLnis APK debug generated
path: ${{ env.main_project_module }}/build/outputs/apk/debug/
# Noted For Output [main_project_module]/build/outputs/apk/release/
- name: Upload APK Release
uses: actions/upload-artifact@v3
with:
name: YTDLnis APK release generated
path: ${{ env.main_project_module }}/build/outputs/apk/release/
# Send Message To Telegram
- name: send telegram message on push or pull
continue-on-error: true
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
${{ github.actor }} created commit:
Commit message: ${{ github.event.commits[0].message }}
Repository: ${{ github.repository }}
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
# # Start Creating Pre-Release
# - name: Start Pre-Release
# uses: actions/checkout@v4
# with:
# persist-credentials: false
# # returns null if no pre-release exists
# - name: Get Commit SHA of Latest Pre-release
# run: |
# # Install Required Packages
# sudo apt-get updated
# sudo apt-get install -y curl jq
# echo "COMMIT_SHA_TAG=$(jq -r 'map(select(.prerelease)) | first | .tag_name' <<< $(curl -s https://api.github.com/repos/deniscerri/ytdlnis/releases))" >> $GITHUB_ENV
#
# - run: gh release delete ${{ env.COMMIT_SHA_TAG }} --cleanup-tag
# if: (env.COMMIT_SHA_TAG != 'null' && contains('Auto-Release', env.COMMIT_SHA_TAG))
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# # Make sure that an old ci that still runs on main doesn't recreate a prerelease
# - name: Check Pullable Commits
# id: check_commits
# run: |
# git fetch
# CHANGES=$(git rev-list HEAD..origin/main --count)
# echo "CHANGES=$CHANGES" >> $GITHUB_ENV
#
# - name: Get Release Name
# id: get_last_release_tag
# run: |
# LASTRELEASE=$(curl "https://api.github.com/repos/deniscerri/ytdlnis/releases/latest")
# ISPRERELEASE=$(echo $LASTRELEASE | jq -r '.prerelease')
# NEWRELEASENAME=$(echo $LASTRELEASE | jq -r '.name')
# if ! $ISPRERELEASE; then NEWRELEASENAME=$(echo $NEWRELEASENAME'.1'); else NEWRELEASENAME=$(echo $NEWRELEASENAME | sed -E 's/(.*\.)([0-9]+)$/echo "\1$((\2 + 1))"/e'); fi
# echo "NEWRELEASENAME=$NEWRELEASENAME" >> $GITHUB_ENV
#
# - name: Get last commit SHA
# id: last_commit
# run: echo "COMMIT_SHA=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
#
# - name: Get commmit date
# id: commit_date
# run: echo "COMMIT_DATE=$(git show -s --date=format:'%Y%m%d' --format=%cd HEAD)" >> $GITHUB_ENV
#
#
# # Create a new pre-release, the other upload_binaries.yml will upload the binaries
# # to this pre-release.
# - name: Create Prerelease
# if: github.ref.name == 'main' && env.CHANGES == '0'
# uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
# with:
# name: ${{ env.NEWRELEASENAME }} [Auto-Release] [${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}]
# tag_name: v${{ env.NEWRELEASENAME }}-beta
# body: ${{ github.event.commits[0].message }}
# prerelease: true
# files: |
# ${{ env.main_project_module }}/build/outputs/apk/release/*
# ${{ env.main_project_module }}/build/outputs/apk/debug/*