Skip to content

Commit 0f83e1d

Browse files
Merge pull request #303 from microsoftgraph/rsh/addBuildWorkflow
Add Build Workflow
1 parent 93bb77c commit 0f83e1d

File tree

3 files changed

+195
-0
lines changed

3 files changed

+195
-0
lines changed

.github/workflows/gradle-build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3+
4+
name: Java CI with Gradle
5+
6+
on:
7+
pull_request:
8+
branches: [ dev, master ]
9+
paths:
10+
- 'src/**'
11+
- '.github/**'
12+
- '!.gradle/wrapper'
13+
- '!.gitignore'
14+
- '!LICENSE'
15+
- '!THIRD PARTY NOTICES'
16+
- '!*.md'
17+
- '*.gradle'
18+
workflow_dispatch:
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Set up JDK 16
26+
uses: actions/setup-java@v2
27+
with:
28+
java-version: '16'
29+
distribution: 'adopt'
30+
cache: gradle
31+
- name: Easy detect-secrets
32+
uses: RobertFischer/detect-secrets-action@v2.0.0
33+
- run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH
34+
shell: pwsh
35+
env:
36+
ENCODED_VALUE: ${{ secrets.LOCAL_PROPERTIES }}
37+
OUPUT_PATH: .\local.properties
38+
- run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH
39+
shell: pwsh
40+
env:
41+
ENCODED_VALUE: ${{ secrets.SECRING_GPG }}
42+
OUPUT_PATH: .\secring.gpg
43+
- name: Grant execute permission for gradlew
44+
run: chmod +x gradlew
45+
- name: Build with Gradle
46+
run: ./gradlew build
47+
- name: Upload a Build Artifact
48+
uses: actions/upload-artifact@v2.2.4
49+
with:
50+
name: drop
51+
path: |
52+
**/libs/*
53+
build/generated-pom.xml
54+
build/generated-pom.xml.asc
55+
build.gradle
56+
gradlew
57+
gradlew.bat
58+
settings.gradle
59+
gradle.properties
60+
**/gradle/**
61+
Scripts/**
62+
63+
64+

.secrets.baseline

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"version": "1.0.3",
3+
"plugins_used": [
4+
{
5+
"name": "ArtifactoryDetector"
6+
},
7+
{
8+
"name": "AWSKeyDetector"
9+
},
10+
{
11+
"name": "AzureStorageKeyDetector"
12+
},
13+
{
14+
"name": "Base64HighEntropyString",
15+
"limit": 4.5
16+
},
17+
{
18+
"name": "BasicAuthDetector"
19+
},
20+
{
21+
"name": "CloudantDetector"
22+
},
23+
{
24+
"name": "HexHighEntropyString",
25+
"limit": 3.0
26+
},
27+
{
28+
"name": "IbmCloudIamDetector"
29+
},
30+
{
31+
"name": "IbmCosHmacDetector"
32+
},
33+
{
34+
"name": "JwtTokenDetector"
35+
},
36+
{
37+
"name": "KeywordDetector",
38+
"keyword_exclude": ""
39+
},
40+
{
41+
"name": "MailchimpDetector"
42+
},
43+
{
44+
"name": "NpmDetector"
45+
},
46+
{
47+
"name": "PrivateKeyDetector"
48+
},
49+
{
50+
"name": "SlackDetector"
51+
},
52+
{
53+
"name": "SoftlayerDetector"
54+
},
55+
{
56+
"name": "SquareOAuthDetector"
57+
},
58+
{
59+
"name": "StripeDetector"
60+
},
61+
{
62+
"name": "TwilioKeyDetector"
63+
}
64+
],
65+
"filters_used": [
66+
{
67+
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
68+
},
69+
{
70+
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
71+
"min_level": 2
72+
},
73+
{
74+
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
75+
},
76+
{
77+
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
78+
},
79+
{
80+
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
81+
},
82+
{
83+
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
84+
},
85+
{
86+
"path": "detect_secrets.filters.heuristic.is_sequential_string"
87+
},
88+
{
89+
"path": "detect_secrets.filters.heuristic.is_templated_secret"
90+
},
91+
{
92+
"path": "detect_secrets.filters.regex.should_exclude_file",
93+
"pattern": [
94+
"gradle.properties"
95+
]
96+
}
97+
],
98+
"results": {},
99+
"generated_at": "2021-09-09T20:53:20Z"
100+
}

scripts/decodeAndWrite.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
<#
5+
.Synopsis
6+
Decode the encoded string and write it to a local file.
7+
.Description
8+
Recieves an encoded string value and decodes it using base64.
9+
Write the new decoded string to a local file for later consumption.
10+
.Parameter encodedValue
11+
The encoded string we wish to decode.
12+
.Parameter outputPath
13+
The file path that we wish to write the decoded value to.
14+
#>
15+
16+
Param(
17+
[string]$encodedValue ,
18+
[string]$outputPath
19+
)
20+
21+
if($outputPath -eq "" -or $null -eq $outputPath) {
22+
Write-Output "Value of Variable: outputPath is Null or Empty. Exiting."
23+
Exit
24+
}
25+
if($encodedValue -eq "" -or $null -eq $encodedValue) {
26+
Write-Output "Value of Variable: encodedValue is Null of Empty. Exiting."
27+
Exit
28+
}
29+
30+
$decodedValue = [System.Convert]::FromBase64String($encodedValue)
31+
Set-Content $outputPath -Value $decodedValue -Encoding Byte

0 commit comments

Comments
 (0)