Skip to content

Commit

Permalink
Update gradle.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrywu authored Nov 16, 2021
1 parent 9237799 commit 18afeac
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,25 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d_%H-%M-%S')"
- name: Get respository name
id: repository_name
run: echo "::set-output name=repository_name::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')"

- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: App
path: ${{ github.workspace }}/app/build/outputs/apk/debug/app-debug.apk
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d_%H-%M-%S')"

- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -46,16 +53,18 @@ jobs:
release_name: ${{ steps.date.outputs.date }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
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
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
asset_path: ${{ github.workspace }}/app/build/outputs/apk/debug/app-debug.apk
asset_name: hello-world.apk
asset_name: ${{ steps.repository_name.outputs.repository_name }}.apk
asset_content_type: application/vnd.android.package-archive

- name: Send mail
if: always()
uses: dawidd6/action-send-mail@v3
Expand All @@ -71,12 +80,12 @@ jobs:
# email body as text
html_body: <h1> Build ${{ job.status }} </h1></br>
<table>
<tr><td> build commit message </td><td>${{ github.event.head_commit.message }}</td></tr>
<tr><td> build commit message </td><td><font color="#3366BB">${{ github.event.head_commit.message }}</font></td></tr>
<tr><td> build commit </td><td>https://github.com/${{ github.repository }}/commit/${{ github.sha }}</td></tr>
<tr><td> build url </td><td>https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}</td></tr>
<tr><td> release url </td><td>${{ steps.create_release.outputs.html_url }}</td></tr>
</table>
# comma-separated string, send email to
to: [email protected],[email protected]
to: [email protected]
# from email name
from: github-${{ github.repository_owner }}

0 comments on commit 18afeac

Please sign in to comment.