Skip to content

Commit 0a092bb

Browse files
committed
add new workflow files / update ecocode-rule-spec / update CHANGELOG
1 parent 36351eb commit 0a092bb

5 files changed

Lines changed: 184 additions & 1 deletion

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
# template source: https://github.com/bretfisher/docker-build-workflow/blob/main/templates/call-docker-build.yaml
3+
name: Docker Build
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
tags:
10+
- '*'
11+
# pull_request:
12+
# branches:
13+
# - main
14+
15+
env:
16+
# github.repository as <account>/<repo>
17+
# IMAGE_NAME: sonarqube-ecocode
18+
# IMAGES: |
19+
# ghcr.io/${{ github.repository_owner }}/sonarqube-ecocode
20+
IMAGE_NAME: sonarqube-ecocode-java
21+
IMAGES: |
22+
ghcr.io/${{ github.repository_owner }}/sonarqube-ecocode-java
23+
24+
jobs:
25+
Build:
26+
runs-on: ubuntu-latest
27+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
28+
permissions:
29+
contents: read
30+
packages: write
31+
# This is used to complete the identity challenge
32+
# with sigstore/fulcio when running outside of PRs.
33+
id-token: write
34+
35+
steps:
36+
- name: Login to GitHub Container Registry
37+
uses: docker/login-action@v2
38+
with:
39+
registry: ghcr.io
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Checkout repository
44+
uses: actions/checkout@v3
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Set up QEMU
49+
uses: docker/setup-qemu-action@v2
50+
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v2
53+
54+
- name: Docker metadata
55+
id: meta
56+
uses: docker/metadata-action@v4
57+
with:
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
images: ${{ env.IMAGES }}
60+
flavor: |
61+
latest=auto
62+
tags: |
63+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
64+
type=semver,event=tag,pattern={{version}}
65+
type=semver,event=tag,pattern={{major}}.{{minor}}
66+
type=semver,event=tag,pattern={{major}}
67+
type=ref,event=branch
68+
type=ref,event=pr
69+
type=sha
70+
71+
- name: Publish image
72+
id: push
73+
uses: docker/build-push-action@v4
74+
with:
75+
push: true
76+
tags: ${{ steps.meta.outputs.tags }}
77+
labels: ${{ steps.meta.outputs.labels }}
78+
pull: true
79+
cache-to: type=gha,mode=max
80+
cache-from: type=gha,mode=max

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515

16+
- Update ecocode-rules-specifications to 1.4.4
17+
1618
### Deleted
1719

1820
[unreleased]: https://github.com/green-code-initiative/ecoCode-java/compare/v1.5.0...HEAD

_TODOs_DDC.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# IDEAS
2+
3+
.. to tranform into issues ?
4+
5+
- [IN PROGRESS] check `pom.xml` dependencies (usefulness, scope, versions)
6+
- [DONE] first clean, check scopes, factorization
7+
- check usefulness
8+
- upgrade versions
9+
- enable github `dependabot` to create automatically PR with version upgrades of dependencides (when all dependencies will be ok)
10+
- ménage dans les branches de dev (local et remote)

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<google.re2j>1.7</google.re2j>
6868

6969
<!-- temporary version waiting for real automatic release in ecocode repository -->
70-
<ecocode-rules-specifications.version>0.0.10</ecocode-rules-specifications.version>
70+
<ecocode-rules-specifications.version>1.4.4</ecocode-rules-specifications.version>
7171

7272
</properties>
7373

0 commit comments

Comments
 (0)