-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build and Tag | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'corretto' | ||
java-version: '17' | ||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-${{ github.ref_name }}-sonar | ||
restore-keys: ${{ runner.os }}-${{ github.ref_name }}-sonar | ||
- name: Build and analyze | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=kasramp-github -Dsonar.projectKey=Eris | ||
- uses: actions/checkout@v3 | ||
- name: Set last commit | ||
shell: bash | ||
run: | | ||
echo "::set-output name=LAST_COMMIT::$(git log -n 1)" | ||
id: version | ||
- name: Tag | ||
shell: bash | ||
env: | ||
VERSION: ${{ steps.version.outputs.LAST_COMMIT }} | ||
EMAIL: ${{ secrets.EMAIL }} | ||
USERNAME: ${{ secrets.USERNAME }} | ||
TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
pwd ${GITHUB_WORKSPACE} | ||
chmod +x "${GITHUB_WORKSPACE}/util/release.sh" | ||
./${GIHUB_WORKSPACE}/util/release.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,15 @@ | ||
name: CI/CD pipeline | ||
name: Do release | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
tags: | ||
- "^(?!.*-beta).*$" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: develop | ||
fetch-depth: 0 | ||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'corretto' | ||
java-version: '17' | ||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
- name: Build and analyze | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=kasramp-github -Dsonar.projectKey=Eris | ||
- uses: actions/checkout@v3 | ||
- name: Set last commit | ||
shell: bash | ||
run: | | ||
echo "::set-output name=LAST_COMMIT::$(git log -n 1)" | ||
id: version | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Release | ||
shell: bash | ||
env: | ||
VERSION: ${{ steps.version.outputs.LAST_COMMIT }} | ||
EMAIL: ${{ secrets.EMAIL }} | ||
USERNAME: ${{ secrets.USERNAME }} | ||
TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
pwd ${GITHUB_WORKSPACE} | ||
chmod +x "${GITHUB_WORKSPACE}/util/release.sh" | ||
./${GIHUB_WORKSPACE}/util/release.sh | ||
uses: softprops/action-gh-release@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
if [ "$LAST_COMMIT" != *"maven-release-plugin"* ]; then | ||
if [[ "$LAST_COMMIT" != *"maven-release-plugin"* ]]; then | ||
git config --global user.email $EMAIL | ||
git config --global user.name $USERNAME | ||
git symbolic-ref HEAD refs/heads/$(git branch --show-current) | ||
git symbolic-ref HEAD | ||
if [ $(git branch --show-current) == "develop" ]; then | ||
mvn -B clean release:clean release:prepare release:perform -Dusername=$USERNAME -Dpassword=$TOKEN -DtagNameFormat=@{artifactId}-beta-@{version} -Darguments="-Dmaven.deploy.skip=true" | ||
else | ||
mvn -B clean release:clean release:prepare release:perform -Dusername=$USERNAME -Dpassword=$TOKEN -Darguments="-Dmaven.deploy.skip=true" | ||
mvn -B clean release:clean release:prepare release:perform -Dusername=$USERNAME -Dpassword=$TOKEN -Darguments="-Dmaven.deploy.skip=true" && | ||
git fetch origin develop && git merge origin/master && | ||
git push https://$USERNAME:$TOKEN@github.com/kasramp/Eris.git HEAD:develop | ||
fi | ||
fi |