Skip to content

maintenance: dependency updates for Gradle plugin repository (#188) #13

maintenance: dependency updates for Gradle plugin repository (#188)

maintenance: dependency updates for Gradle plugin repository (#188) #13

name: Doppelganger API Detector Plugin - Release
on:
push:
branches:
- main
paths:
- 'doppelganger-api-detector/*.gradle'
- 'doppelganger-api-detector/gradle/**'
- 'doppelganger-api-detector/src/main/**'
- 'doppelganger-api-detector/docs/**'
workflow_dispatch: {}
jobs:
Calculate-Version:
uses: ./.github/workflows/semantic-version-calculate.yml
with:
fail_on_empty_version: true
project_dir: doppelganger-api-detector
tag_format: 'doppelganger-api-detector-v${version}'
DEBUG: true
secrets:
sem_rel_token_token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
Build:
name: Build Doppelganger API Detector Plugin
needs: Calculate-Version
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
env:
GRADLE_PROPERTIES_FILE: ./doppelganger-api-detector/gradle.properties
GRADLE_VERSION_REGEX: version\s*=\s*[0-9]\\+\.[0-9]\\+\.[0-9]\\+[a-zA-Z0-9.-]*
VERSION: ${{ needs.Calculate-Version.outputs.next_version }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Java
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
distribution: 'temurin'
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
- name: Update version in Gradle property file
run: |
echo "VERSION=${{ env.VERSION }}"
echo ===== Before - ${{ env.GRADLE_PROPERTIES_FILE }} =====
cat ${{ env.GRADLE_PROPERTIES_FILE }}
sed -i "s/${{ env.GRADLE_VERSION_REGEX }}/version = ${{ env.VERSION }}/g" ${{ env.GRADLE_PROPERTIES_FILE }}
echo ===== After - ${{ env.GRADLE_PROPERTIES_FILE }} =====
cat ${{ env.GRADLE_PROPERTIES_FILE }}
- name: Build and test Doppelganger API Detector Plugin
run: |
cd doppelganger-api-detector
chmod +x ./gradlew
./gradlew build
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.SEDR_AUTOMATION_TOKEN }}
- name: Upload test report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: doppelganger-api-detector-plugin-test-results
path: doppelganger-api-detector/build/reports/tests/**
Release-Plugin:
name: Release Doppelganger API Detector Plugin
needs: [Calculate-Version, Build]
if: ${{ needs.Calculate-Version.outputs.next_version != '' }}
uses: ./.github/workflows/semantic-version-apply.yml
with:
project_dir: doppelganger-api-detector
secrets:
sem_rel_token_token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
Publish:
name: Publish Doppelganger API Detector Plugin to Gradle Portal
needs: [Calculate-Version, Release-Plugin]
if: ${{ needs.Calculate-Version.outputs.next_version != '' }}
runs-on: ubuntu-latest
env:
GRADLE_PROPERTIES_FILE: ./doppelganger-api-detector/gradle.properties
GRADLE_VERSION_REGEX: version\s*=\s*[0-9]\\+\.[0-9]\\+\.[0-9]\\+[a-zA-Z0-9.-]*
VERSION: ${{ needs.Calculate-Version.outputs.next_version }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
- name: Setup Java
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
distribution: 'temurin'
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
- name: Update version in Gradle property file
run: |
sed -i "s/${{ env.GRADLE_VERSION_REGEX }}/version = ${{ env.VERSION }}/g" ${{ env.GRADLE_PROPERTIES_FILE }}
- name: Publish to Gradle Plugin Portal
run: |
cd doppelganger-api-detector
chmod +x ./gradlew
./gradlew publishPlugins --no-daemon --no-configuration-cache
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.SEDR_AUTOMATION_TOKEN }}
Determine-Release-Type:
needs: [Calculate-Version]
if: ${{ needs.Calculate-Version.outputs.next_version != '' }}
uses: ./.github/workflows/determine-release-type.yml
Workflow-Summary:
name: Workflow Summary
needs: [Build, Publish, Release-Plugin, Determine-Release-Type]
if: always()
runs-on: ubuntu-latest
steps:
- name: Output release completion
run: |
echo "Doppelganger API Detector Plugin ${{ needs.Determine-Release-Type.outputs.release_type }} release workflow completed"
echo "::notice title=Release Complete::Doppelganger API Detector Plugin ${{ needs.Determine-Release-Type.outputs.release_type }} release workflow completed"