|
| 1 | +name: Manual Release |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + confirmeRelease: |
| 6 | + description: 'Confirm manual release creation (by typing "true") ? ----- WARNING : check version (in pom.xml files) and release notes (in CHANGELOG.md file) before confirm' |
| 7 | + default: 'false' |
| 8 | +jobs: |
| 9 | + checks: |
| 10 | + name: Requirements |
| 11 | + if: github.event.inputs.confirmeRelease == 'true' |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Check user permissions |
| 15 | + uses: 74th/workflow-permission-action@1.0.0 |
| 16 | + with: |
| 17 | + users: dedece35,glalloue,jhertout,jules-delecour-dav,olegoaer,zippy1978 |
| 18 | + build: |
| 19 | + name: Build And Release |
| 20 | + needs: checks |
| 21 | + runs-on: ubuntu-latest |
| 22 | + permissions: write-all |
| 23 | + outputs: |
| 24 | + last_tag: ${{ steps.export_last_tag.outputs.last_tag }} |
| 25 | + upload_url: ${{ steps.export_upload_url.outputs.upload_url }} |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v3 |
| 29 | + - name: Change commiter |
| 30 | + run: | |
| 31 | + git config user.name 'github-actions[bot]' |
| 32 | + git config user.email '' |
| 33 | + - name: Maven release |
| 34 | + run: mvn release:prepare -B -ff -DtagNameFormat=@{project.version} |
| 35 | + - name: Maven release clean |
| 36 | + run: mvn release:clean |
| 37 | + - name: Get last TAG |
| 38 | + run: echo "LAST_TAG=$(git tag --sort=-version:refname | head -n 1)" >> $GITHUB_ENV |
| 39 | + - name: Extract release notes |
| 40 | + id: extract-release-notes |
| 41 | + uses: ffurrer2/extract-release-notes@v1 |
| 42 | + - name: Checkout tag "${{ env.LAST_TAG }}" |
| 43 | + uses: actions/checkout@v3 |
| 44 | + with: |
| 45 | + ref: ${{ env.LAST_TAG }} |
| 46 | + - name: Build project |
| 47 | + run: mvn -e -B clean package -DskipTests |
| 48 | + - name: Create release |
| 49 | + id: create_release |
| 50 | + uses: actions/create-release@v1 |
| 51 | + env: |
| 52 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + with: |
| 54 | + tag_name: ${{ env.LAST_TAG }} |
| 55 | + release_name: Release ${{ env.LAST_TAG }} |
| 56 | + draft: false |
| 57 | + prerelease: false |
| 58 | + body: ${{ steps.extract-release-notes.outputs.release_notes }} |
| 59 | + - name: Export plugin Jar files |
| 60 | + id: export_jar_files |
| 61 | + uses: actions/upload-artifact@v3 |
| 62 | + with: |
| 63 | + name: ecocode-plugins |
| 64 | + path: lib |
| 65 | + - name: Export LAST_TAG |
| 66 | + id: export_last_tag |
| 67 | + run: echo "last_tag=${{ env.LAST_TAG }}" >> $GITHUB_OUTPUT |
| 68 | + - name: Export UPLOAD_URL |
| 69 | + id: export_upload_url |
| 70 | + run: echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT |
| 71 | + upload-java: |
| 72 | + name: Upload Java Plugin |
| 73 | + runs-on: ubuntu-latest |
| 74 | + needs: build |
| 75 | + steps: |
| 76 | + - name: Import plugin JAR files |
| 77 | + id: import_jar_files |
| 78 | + uses: actions/download-artifact@v3 |
| 79 | + with: |
| 80 | + name: ecocode-plugins |
| 81 | + path: lib |
| 82 | + - name: Upload Release Asset - Java Plugin |
| 83 | + id: upload-release-asset |
| 84 | + uses: actions/upload-release-asset@v1 |
| 85 | + env: |
| 86 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 87 | + with: |
| 88 | + upload_url: ${{needs.build.outputs.upload_url}} |
| 89 | + asset_path: lib/ecocode-java-plugin-${{ needs.build.outputs.last_tag }}.jar |
| 90 | + asset_name: ecocode-java-plugin-${{ needs.build.outputs.last_tag }}.jar |
| 91 | + asset_content_type: application/zip |
0 commit comments