<commit_before>name: Release Pipeline

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
    types: [ opened, synchronize ]

jobs:

  build:
    if:       "!contains(github.event.head_commit.message, 'ci skip')"
    runs-on:  ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Setup Java
        uses: actions/setup-java@v2
        with:
          java-version: '8'
          distribution: 'adopt'
          cache: 'maven'

      - uses: ./.github/actions/setup-git
        with:
          github_token:   ${{ secrets.GITHUB_TOKEN }}
          git_user_email: ${{ secrets.RELEASE_GH_EMAIL }}
          git_username:   ${{ secrets.RELEASE_GH_USERNAME }}

      - name: Set version (master only)
        if: github.ref == 'refs/heads/master'
        run: mvn --batch-mode release-candidate:updateVersion

      - name: Build with Maven
        run: mvn --batch-mode --update-snapshots verify

      - name: Read $version (master only)
        if: github.ref == 'refs/heads/master'
        run: cat build-monitor-plugin/target/classes/build-monitor.properties >> $GITHUB_ENV

      - uses: actions/upload-artifact@v2
        with:
          retention-days: 3
          name: artifacts
          path: |
            build-monitor-plugin/target/*.hpi
            pom.xml
            build-monitor-plugin/pom.xml
            build-monitor-acceptance/pom.xml
            build-monitor-acceptance/build-monitor-acceptance-base/pom.xml
            build-monitor-acceptance/build-monitor-acceptance-latest/pom.xml
            build-monitor-acceptance/build-monitor-acceptance-base/target/failsafe-reports/*-output.txt
            build-monitor-acceptance/build-monitor-acceptance-latest/target/failsafe-reports/*-output.txt

      - name: Create Release Branch (master only)
        if: github.ref == 'refs/heads/master'
        run: |
          git checkout -b "release-${version}"
          git commit -a -m "Release candidate v$version"
          git push origin "release-$version"

      - name: Setup https://repo.jenkins-ci.org/ (master only)
        if: github.ref == 'refs/heads/master'
        uses: actions/setup-java@v2
        with:
          java-version: '8'
          distribution: 'adopt'
          cache: 'maven'
          server-id: 'repo.jenkins-ci.org'
          server-username: ${{ secrets.JENKINS_REPO_USERNAME }}
          server-password: ${{ secrets.JENKINS_REPO_TOKEN }}

      - name: Publish (master only)
        if: github.ref == 'refs/heads/master'
        run: |
          mvn --batch-mode deploy:deploy-file -DpomFile=build-monitor-plugin/pom.xml \
            -Dfile=build-monitor-plugin/target/build-monitor-plugin.hpi \
            -DrepositoryId=repo.jenkins-ci.org \
            -Durl=https://repo.jenkins-ci.org/artifactory/public/<commit_msg>Corrected the publish command<commit_after>name: Release Pipeline

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
    types: [ opened, synchronize ]

jobs:

  build:
    if:       "!contains(github.event.head_commit.message, 'ci skip')"
    runs-on:  ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Setup Java
        uses: actions/setup-java@v2
        with:
          java-version: '8'
          distribution: 'adopt'
          cache: 'maven'

      - uses: ./.github/actions/setup-git
        with:
          github_token:   ${{ secrets.GITHUB_TOKEN }}
          git_user_email: ${{ secrets.RELEASE_GH_EMAIL }}
          git_username:   ${{ secrets.RELEASE_GH_USERNAME }}

      - name: Set version (master only)
        if: github.ref == 'refs/heads/master'
        run: mvn --batch-mode release-candidate:updateVersion

      - name: Build with Maven
        run: mvn --batch-mode --update-snapshots verify

      - name: Read $version (master only)
        if: github.ref == 'refs/heads/master'
        run: cat build-monitor-plugin/target/classes/build-monitor.properties >> $GITHUB_ENV

      - uses: actions/upload-artifact@v2
        with:
          retention-days: 3
          name: artifacts
          path: |
            build-monitor-plugin/target/*.hpi
            pom.xml
            build-monitor-plugin/pom.xml
            build-monitor-acceptance/pom.xml
            build-monitor-acceptance/build-monitor-acceptance-base/pom.xml
            build-monitor-acceptance/build-monitor-acceptance-latest/pom.xml
            build-monitor-acceptance/build-monitor-acceptance-base/target/failsafe-reports/*-output.txt
            build-monitor-acceptance/build-monitor-acceptance-latest/target/failsafe-reports/*-output.txt

      - name: Create Release Branch (master only)
        if: github.ref == 'refs/heads/master'
        run: |
          git checkout -b "release-${version}"
          git commit -a -m "Release candidate v$version"
          git push origin "release-$version"

      - name: Setup repo.jenkins-ci.org (master only)
        if: github.ref == 'refs/heads/master'
        uses: actions/setup-java@v2
        with:
          java-version: '8'
          distribution: 'adopt'
          cache: 'maven'
          server-id: 'repo.jenkins-ci.org'
          server-username: ${{ secrets.JENKINS_REPO_USERNAME }}
          server-password: ${{ secrets.JENKINS_REPO_TOKEN }}

      - name: Publish (master only)
        if: github.ref == 'refs/heads/master'
        run: |
          mvn --batch-mode deploy:deploy-file -DpomFile=build-monitor-plugin/pom.xml \
            -Dfile=build-monitor-plugin/target/build-monitor-plugin.hpi \
            -DrepositoryId=repo.jenkins-ci.org \
            -Durl=https://repo.jenkins-ci.org/artifactory/releases/ \
            -DrepositoryId=releases
{'fraction_non_alphanumeric': 0.11932888204074645, 'fraction_numerical': 0.002739256976545112, 'mean_word_length': 2.00978876867594, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '488000', 'n_tokens_mistral': 1850, 'n_tokens_neox': 1766, 'n_words': 329}