Skip to content

Commit 27df033

Browse files
authored
Create build_apk.yml
1 parent 6be1788 commit 27df033

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/build_apk.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build_TouchHelper_APK
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
push:
9+
branches: [ master ]
10+
pull_request:
11+
branches: [ master ]
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
15+
# This workflow contains a single job called "build"
16+
build:
17+
# The type of runner that the job will run on
18+
runs-on: ubuntu-latest
19+
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
23+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
24+
- name: checkout codes
25+
uses: actions/checkout@v2
26+
with:
27+
fetch-depth: '0' # 0 indicates all history, this is needed for git revision
28+
29+
- name: Set up JDK 1.8
30+
uses: actions/setup-java@v1
31+
with:
32+
java-version: 1.8
33+
34+
- name: Assemble Release APK
35+
run: ./gradlew assembleRelease --stacktrace
36+
37+
- name: Upload APK to artifacts
38+
uses: actions/upload-artifact@v1
39+
with:
40+
name: TouchHelper
41+
path: ./app/build/outputs/apk/
42+
43+
- name: Create ZIPs
44+
working-directory: ./app/build/outputs/apk/
45+
run: |
46+
zip -r ./TouchHelper.zip ./release
47+
48+
- name: Get git revision
49+
id: get_git_revision
50+
run: |
51+
echo "::set-output name=tag_name::$(($(git rev-list HEAD --count) + 100))"
52+
echo "::set-output name=release_name::$(($(git rev-list HEAD --count) + 100))"
53+
54+
- name: Create Release
55+
id: create_release
56+
uses: actions/create-release@v1
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
tag_name: tag-${{ steps.get_git_revision.outputs.tag_name }}
61+
release_name: Release ${{ steps.get_git_revision.outputs.release_name }}
62+
draft: false
63+
prerelease: false
64+
65+
- name: Upload Release APK
66+
id: upload-release-asset-images
67+
uses: actions/upload-release-asset@v1
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
72+
asset_path: ./app/build/outputs/apk/TouchHelper.zip
73+
asset_name: TouchHelper.zip
74+
asset_content_type: application/zip

0 commit comments

Comments
 (0)