All Downloads are FREE. Search and download functionalities are using the official Maven repository.

github.workflows.release.yml Maven / Gradle / Ivy

Go to download

Resources, like Checkstyle rules and site templates, for FreeLibrary projects.

There is a newer version: 12.0.2
Show newest version
name: Maven Release

# Performs a Maven release using JDK 11 when a new GitHub release has been published
on:
  release:
    types: [ published ]

jobs:
  publish:
    name: Maven Artifact Publisher (JDK 11)
    runs-on: ubuntu-latest
    env:
      AUTORELEASE_ARTIFACT: ${{ secrets.AUTORELEASE_ARTIFACT }}
      SKIP_JAR_DEPLOYMENT: ${{ secrets.SKIP_JAR_DEPLOYMENT }}
      MAVEN_CACHE_KEY: ${{ secrets.MAVEN_CACHE_KEY }}
    steps:
      - name: Check out source code
        uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2
      - name: Install JDK 11
        uses: actions/setup-java@764a52df183aa0ccea74521dfd9d506ffc7a19a # v2
        with:
          distribution: 'adopt'
          java-version: 11
      # If running locally in act, install Maven
      - name: Set up Maven if needed
        if: ${{ env.ACT }}
        uses: stCarolas/setup-maven@1d56b37995622db66cce1214d81014b09807fb5a # v4
        with:
          maven-version: 3.6.3
      - name: Set up Maven cache
        uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a # v2
        if: ${{ env.MAVEN_CACHE_KEY }}
        with:
          path: ~/.m2
          key: freelibrary-cache-${{ secrets.MAVEN_CACHE_KEY }}-${{ hashFiles('**/pom.xml') }}
          restore-keys: freelibrary-cache-${{ secrets.MAVEN_CACHE_KEY }}-
      - name: Set autorelease config
        if: env.AUTORELEASE_ARTIFACT == null
        run: echo "AUTORELEASE_ARTIFACT=false" >> $GITHUB_ENV
      - name: Set Jar deployment config
        if: env.SKIP_JAR_DEPLOYMENT == null
        run: echo "SKIP_JAR_DEPLOYMENT=false" >> $GITHUB_ENV
      - name: Optionally, login to Docker repository
        uses: docker/login-action@f3364599c6aa293cdc2b8391b1b56d0c30e45c8a # v1.8.0
        env:
          DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
        if: env.DOCKER_USERNAME != null
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      - name: Release with Maven
        uses: samuelmeuli/action-maven-publish@201a45a3f311b2ee888f252ba9f4194257545709 # v1.4.0
        with:
          gpg_private_key: ${{ secrets.BUILD_KEY }}
          gpg_passphrase: ${{ secrets.BUILD_PASSPHRASE }}
          nexus_username: ${{ secrets.SONATYPE_USERNAME }}
          nexus_password: ${{ secrets.SONATYPE_PASSWORD }}
          maven_profiles: release,${{ secrets.BUILD_PROFILES }}
          maven_args: >
            -Drevision=${{ github.event.release.tag_name }} -DautoReleaseAfterClose=${{ env.AUTORELEASE_ARTIFACT }}
            -ntp -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=error ${{ secrets.BUILD_PROPERTIES }}
            -DskipNexusStagingDeployMojo=${{ env.SKIP_JAR_DEPLOYMENT }}
            -Ddocker.registry.username=${{ secrets.DOCKER_USERNAME }}
            -Ddocker.registry.account=${{ secrets.DOCKER_REGISTRY_ACCOUNT}}
            -Ddocker.registry.password=${{ secrets.DOCKER_PASSWORD }}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy