From ac1d9479a050c19cc33f2b6924c3da74b54bfa1c Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Thu, 16 Sep 2021 12:41:23 -0700 Subject: [PATCH 01/10] Added workflow for main and release branches. --- .github/workflows/main.yml | 48 ++++++++++++++++++++++++++++++++++++++ .gitignore | 3 ++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..fc29f87 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,48 @@ + +# This is a basic workflow to help you get started with Actions + +name: Test & Archive + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ main, 'release/**'] + pull_request: + branches: [ main ] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Clean + run: ./gradlew clean --refresh-dependencies --stacktrace + + - name: Build APK + run: ./gradlew --stacktrace buildRelease + + - name: Build AAB + run: ./gradlew --stacktrace bundleRelease + + - name: Archive Artifacts + uses: actions/upload-artifact@v2 + with: + name: APK & AAB artifacts + path: | + app/build/outputs/apk/ + app/build/outputs/bundle/ + + - name: Send Slack Message + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: always() \ No newline at end of file diff --git a/.gitignore b/.gitignore index 960d79b..6bb100f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ **/.gradle/** -**/build/ \ No newline at end of file +**/build/ +**/.idea/ \ No newline at end of file From 5b7d25422e69455fd3c3085f0b758b0ddcf5fe84 Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Thu, 16 Sep 2021 12:42:46 -0700 Subject: [PATCH 02/10] Run on feature branch --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fc29f87..e91ce4e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ name: Test & Archive on: # Triggers the workflow on push or pull request events but only for the main branch push: - branches: [ main, 'release/**'] + branches: [ main, 'release/**', feature/github-actions] pull_request: branches: [ main ] From 87e31022b9869ba24c68a79d0bd2189ebe7f476c Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Thu, 16 Sep 2021 12:46:24 -0700 Subject: [PATCH 03/10] Run on feature branch --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e91ce4e..e13dfd5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,10 @@ name: Test & Archive on: # Triggers the workflow on push or pull request events but only for the main branch push: - branches: [ main, 'release/**', feature/github-actions] + branches: + - main + - 'release/**' + - feature/github-actions pull_request: branches: [ main ] From 3fcc9275c936ea9a0a842bdc09ea94c53cbae137 Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Thu, 16 Sep 2021 12:52:54 -0700 Subject: [PATCH 04/10] Change default working directory --- .github/workflows/main.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e13dfd5..1182b3e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,6 @@ +name: Build & Archive App -# This is a basic workflow to help you get started with Actions - -name: Test & Archive - -# Controls when the action will run. on: - # Triggers the workflow on push or pull request events but only for the main branch push: branches: - main @@ -20,6 +15,10 @@ jobs: build: runs-on: ubuntu-latest + defaults: + run: + working-directory: ./android-studio-sample-app + steps: - name: Checkout uses: actions/checkout@v2 From d6e5973f96a48a6f70a395c5cc57f2bb23cccab9 Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Thu, 16 Sep 2021 13:18:49 -0700 Subject: [PATCH 05/10] Added a draft release workflow on pushes with tags that start with 'v'. --- .github/workflows/release.yml | 19 +++++++++++++++++++ release-notes.md | 0 2 files changed, 19 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 release-notes.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ee63786 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,19 @@ +name: Draft Release + +on: + push: + tags: + - 'v*' + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ncipollo/release-action@v1 + with: + artifacts: "fraudforce-lib*.aar" + draft: true + bodyFile: "release-notes.md" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/release-notes.md b/release-notes.md new file mode 100644 index 0000000..e69de29 From aaca053d2fcc6c594d2b0ed18e545deeb51ced29 Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Fri, 17 Sep 2021 10:21:07 -0700 Subject: [PATCH 06/10] Fix output artifacts not archiving --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1182b3e..9329b3f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,8 +37,8 @@ jobs: with: name: APK & AAB artifacts path: | - app/build/outputs/apk/ - app/build/outputs/bundle/ + **/*.apk + **/*.aab - name: Send Slack Message uses: 8398a7/action-slack@v3 From fc22266661bafaf622725b4970a95f00cc9185df Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Fri, 17 Sep 2021 10:36:04 -0700 Subject: [PATCH 07/10] Archiving all outputs --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9329b3f..16ea6ba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: run: ./gradlew clean --refresh-dependencies --stacktrace - name: Build APK - run: ./gradlew --stacktrace buildRelease + run: ./gradlew --stacktrace assembleRelease - name: Build AAB run: ./gradlew --stacktrace bundleRelease @@ -37,8 +37,7 @@ jobs: with: name: APK & AAB artifacts path: | - **/*.apk - **/*.aab + **/app/build/outputs/ - name: Send Slack Message uses: 8398a7/action-slack@v3 From 6fce4a48e3c3cd0685dff3db19179297a47645b2 Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Fri, 17 Sep 2021 10:57:52 -0700 Subject: [PATCH 08/10] Archiving only aab and apk --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16ea6ba..1bd8777 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,7 +37,9 @@ jobs: with: name: APK & AAB artifacts path: | - **/app/build/outputs/ + **/app/build/outputs/apk/ + **/app/build/outputs/bundle/ + !**/*.json - name: Send Slack Message uses: 8398a7/action-slack@v3 From 7edd6203951d3e64b3528d402222cc12d3346483 Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Wed, 22 Sep 2021 11:10:00 -0700 Subject: [PATCH 09/10] Removed feature branch for testing --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1bd8777..097f92c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,6 @@ on: branches: - main - 'release/**' - - feature/github-actions pull_request: branches: [ main ] From b6fd1cab8091bd6ac3a42d4542f1752f97350000 Mon Sep 17 00:00:00 2001 From: Rolly Lacap Date: Wed, 22 Sep 2021 11:14:34 -0700 Subject: [PATCH 10/10] Added new line ending to files --- .github/workflows/main.yml | 2 +- .github/workflows/release.yml | 2 +- .gitignore | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 097f92c..ded3a89 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,4 +47,4 @@ jobs: fields: repo,message,commit,author,action,eventName,ref,workflow,job,took env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: always() \ No newline at end of file + if: always() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ee63786..dea0598 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,4 +16,4 @@ jobs: artifacts: "fraudforce-lib*.aar" draft: true bodyFile: "release-notes.md" - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 6bb100f..51de567 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ **/.gradle/** **/build/ -**/.idea/ \ No newline at end of file +**/.idea/