Skip to content

Commit 0f83e1d

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

3 files changed

Lines changed: 195 additions & 0 deletions

File tree

‎.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
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎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)