From efb723129fb8035905752ea23e032d858daf8998 Mon Sep 17 00:00:00 2001 From: David DE CARVALHO Date: Wed, 14 Dec 2022 23:10:55 +0100 Subject: [PATCH] [ISSUE 16] initiate release system --- .github/workflows/build.yml | 10 ++- .github/workflows/tag_release.yml | 104 ++++++++++++++++++++++++++++++ .gitignore | 2 +- CHANGELOG.md | 16 +++++ 4 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/tag_release.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e3bd3639..fe367800d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,11 @@ -name: Build +name: Build and Tests on: push: branches: - main + paths-ignore: + - '*.md' + - '.github/**/*.yml' pull_request: types: [opened, synchronize, reopened] jobs: @@ -10,7 +13,8 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Set up JDK 11 @@ -39,4 +43,4 @@ jobs: # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # run: mvn -e -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=ecocode -Dsonar.exclusions=**/*.groovy,**/*.dummy # waiting for sonarqube secrets - run: mvn -e -B verify + run: mvn -e -B clean compile verify diff --git a/.github/workflows/tag_release.yml b/.github/workflows/tag_release.yml new file mode 100644 index 000000000..8f1d1260f --- /dev/null +++ b/.github/workflows/tag_release.yml @@ -0,0 +1,104 @@ +name: Tag Release +on: + push: + tags: + - '*.*.*' +jobs: + build: + name: Build And Release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Extract release notes + id: extract-release-notes + uses: ffurrer2/extract-release-notes@v1 + with: + prerelease: true + - name: Build project + run: mvn -e -B clean package -DskipTests + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + body: ${{ steps.extract-release-notes.outputs.release_notes }} + - name: Share upload URL + id: share_upload_url + run: echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT + - name: Share plugin Jar files + id: share_jar_files + uses: actions/upload-artifact@v3 + with: + name: ecocode-plugins + path: lib + updload-java: + name: Upload Java Plugin + runs-on: ubuntu-latest + needs: build + steps: + - name: Download plugin JAR files + id: download_jar_files + uses: actions/download-artifact@v3 + with: + name: ecocode-plugins + path: lib + - name: Upload Release Asset - Java Plugin + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{needs.build.outputs.upload_url}} + asset_path: lib/ecocode-java-plugin-0.1.0-SNAPSHOT.jar + asset_name: ecocode-java-plugin-${{ github.ref_name }}.jar + asset_content_type: application/zip + updload-php: + name: Upload PHP Plugin + runs-on: ubuntu-latest + needs: build + steps: + - name: Download plugin JAR files + id: download_jar_files + uses: actions/download-artifact@v3 + with: + name: ecocode-plugins + path: lib + - name: Upload Release Asset - PHP Plugin + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{needs.build.outputs.upload_url}} + asset_path: lib/ecocode-php-plugin-0.1.0-SNAPSHOT.jar + asset_name: ecocode-php-plugin-${{ github.ref_name }}.jar + asset_content_type: application/zip + updload-python: + name: Upload Python Plugin + runs-on: ubuntu-latest + needs: build + steps: + - name: Download plugin JAR files + id: download_jar_files + uses: actions/download-artifact@v3 + with: + name: ecocode-plugins + path: lib + - name: Upload Release Asset - Python Plugin + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{needs.build.outputs.upload_url}} + asset_path: lib/ecocode-python-plugin-0.1.0-SNAPSHOT.jar + asset_name: ecocode-python-plugin-${{ github.ref_name }}.jar + asset_content_type: application/zip diff --git a/.gitignore b/.gitignore index d188e1bdd..f83f86ce0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ !.gitignore -!.github/workflows +!.github/**/*.* .* diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..a7a8d5298 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.1.0] - 2022-12-14 + +- First official release of ecocode plugins : java plugin, php plugin and python plugin + +[unreleased]: https://github.com/green-code-initiative/ecoCode/compare/v0.1.1...HEAD +[0.1.1]: https://github.com/green-code-initiative/ecoCode/compare/v0.1.0...v0.1.1 +[0.1.0]: https://github.com/green-code-initiative/ecoCode/releases/tag/v0.1.0 \ No newline at end of file