Merge pull request #1511 from microsoftgraph/dependabot/gradle/io.git… #820
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish | |
on: | |
push: | |
branches: [dev, master, support/2.x.x] | |
paths-ignore: | |
- '.gradle/wrapper' | |
- '.gitignore' | |
- 'LICENSE' | |
- 'THIRD PARTY NOTICES' | |
- '*.md' | |
env: | |
PREVIEW_TASK: publishSnapshotPublicationToSonatypeSnapshotRepository | |
PUBLISH_TASK: publishMavenCentralReleasePublicationToSonatypeRepository | |
jobs: | |
maven_Preview: | |
if: ${{ github.ref == 'refs/heads/dev' }} | |
environment: | |
name: maven_central_snapshot | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Easy detect-secrets | |
uses: RobertFischer/detect-secrets-action@v2.0.0 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 20 | |
distribution: 'temurin' | |
cache: gradle | |
- name: Download file | |
run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH | |
shell: pwsh | |
env: | |
ENCODED_VALUE: ${{ secrets.LOCAL_PROPERTIES }} | |
OUTPUT_PATH: '.\local.properties' | |
- name: Download file | |
run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH | |
shell: pwsh | |
env: | |
ENCODED_VALUE: ${{ secrets.SECRING_GPG }} | |
OUTPUT_PATH: '.\secring.gpg' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Publish | |
run: ./gradlew $PREVIEW_TASK | |
maven_Release: | |
if: ${{ github.ref == 'refs/heads/master' }} | |
environment: | |
name: maven_central_release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Easy detect-secrets | |
uses: RobertFischer/detect-secrets-action@v2.0.0 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 20 | |
distribution: 'temurin' | |
cache: gradle | |
- name: Download file | |
run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH | |
shell: pwsh | |
env: | |
ENCODED_VALUE: ${{ secrets.LOCAL_PROPERTIES }} | |
OUTPUT_PATH: '.\local.properties' | |
- name: Download file | |
run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH | |
shell: pwsh | |
env: | |
ENCODED_VALUE: ${{ secrets.SECRING_GPG }} | |
OUTPUT_PATH: '.\secring.gpg' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Publish | |
run: ./gradlew $PUBLISH_TASK | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: drop | |
path: | | |
**/libs/* | |
build/generated-pom.xml | |
build/generated-pom.xml.asc | |
build.gradle | |
gradlew | |
gradlew.bat | |
settings.gradle | |
gradle.properties | |
**/gradle/** | |
Scripts/** | |
create_Tag: | |
needs: maven_Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
RELEASE_TAG: "" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Version | |
id: GetVersion | |
run: .\scripts\getLatestVersion.ps1 | |
shell: pwsh | |
- name: Create tag | |
uses: rickstaa/action-create-tag@v1.7.2 | |
with: | |
tag: ${{ steps.GetVersion.outputs.tag }} | |
- name: Queue Git Release | |
uses: benc-uk/workflow-dispatch@v121 | |
with: | |
workflow: Git Release | |
token: ${{ secrets.PERSONAL_TOKEN }} | |
ref: ${{ steps.GetVersion.outputs.tag }} | |