Skip to content

Commit

Permalink
Merge pull request #136 from franceme/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
franceme authored Nov 17, 2020
2 parents 2436067 + 7f66967 commit 251614d
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Clean, build, test, and release the project.

on:
[push, workflow_dispatch]

jobs:
Setup:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Granting Execution permission
run: chmod +x gradlew

- name: Setup Android Environment
run: cd /opt && wget --output-document=android-sdk.zip --quiet https://dl.google.com/android/repository/android-22_r02.zip && unzip android-sdk.zip && mv android-5.1.1 android && sudo chown -R 777 android

- name: Downloading SDK Man
run: curl -s "https://get.sdkman.io" | bash

- name: Initializing SDKMan
run: source ~/.sdkman/bin/sdkman-init.sh && chmod 777 -R ~/.sdkman

- name: Installing Java 7 from SDKMan
run: source ~/.sdkman/bin/sdkman-init.sh && yes | sdk install java $(sdk ls java|grep 7.0.*-zulu|head -n 1|cut -d '|' -f6|awk '{$1=$1};1')

- name: Installing Java 8 from SDKMan
run: source ~/.sdkman/bin/sdkman-init.sh && yes | sdk install java $(sdk ls java|grep 8.0.*-zulu|head -n 1|cut -d '|' -f6|awk '{$1=$1};1')

- name: Installing Gradle 6 from SDKMan
run: source ~/.sdkman/bin/sdkman-init.sh && yes | sdk install gradle 6.0

- name: Setting up Android SDK in SDKMan
run: mkdir -p ~/.sdkman/candidates/android/22_r02

- name: Moving the Android SDK into SDKMan
run: mv /opt/android ~/.sdkman/candidates/android/22_r02/platforms

- name: Linking the latest Android SDK in the SDKMan Structure
run: ln -s ~/.sdkman/candidates/android/22_r02/platforms ~/.sdkman/candidates/android/current

- name: Read version from Properties-file
id: read_property_original
uses: christian-draeger/read-properties@1.0.1
with:
path: 'gradle.properties'
property: 'versionNumber'

- name: Get Time
id: time
uses: nanzm/get-time-action@v1.0
with:
format: 'YYYY-MM-DD-HH-mm'

- name: Find and Replace
uses: shitiomatic/str-replace@master
with:
find: "${{steps.read_property_original.outputs.value}}"
replace: "${{steps.read_property_original.outputs.value}}_${{ steps.time.outputs.time }}"
include: gradle.properties

- name: Read version from Properties-file
id: read_property
uses: christian-draeger/read-properties@1.0.1
with:
path: 'gradle.properties'
property: 'versionNumber'

- name: Building the project
run: ./gradlew clean build # -x test

- name: Move the Jar File
if: github.ref == 'refs/heads/master'
run: mv build/libs/cryptoguard-*.jar cryptoguard.jar

- name: Create Release
if: github.ref == 'refs/heads/master'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: Release_${{ steps.read_property.outputs.value }}_${{ steps.time.outputs.value }}
release_name: Release_${{ steps.read_property.outputs.value }}_${{ steps.time.outputs.value }}
body: Release_${{ steps.read_property.outputs.value }}}_${{ steps.time.outputs.value }}

- name: Upload the Jar to the Release
if: github.ref == 'refs/heads/master'
id: upload-release-asset-resume
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/cryptoguard.jar
asset_name: cryptoguard.jar
asset_content_type: application/jar
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ task writeTestInformation {

//Ensuring all of the processors are being used for tests
test {
exclude '**/ArgumentsCheckTest.class'
exclude '**/EntryPointTest_SOURCE.class'

environment "ANDROID_HOME", System.getenv("ANDROID_HOME") ?: "ANDROIDSDK"
environment "JAVA_HOME", System.getenv("JAVA_HOME") ?: "JAVA8SDK"
environment "JAVA7_HOME", System.getenv("JAVA7_HOME") ?: "JAVA7SDK"
Expand Down

0 comments on commit 251614d

Please sign in to comment.