Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(updater): Add github actions to autoupdate dependencies #54

Merged
merged 7 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,20 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up NodeJS
if: github.ref == 'refs/heads/main' # especificar rama principal
if: github.ref == 'refs/heads/main'
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Set up Semantic Release
if: github.ref == 'refs/heads/main' # especificar rama principal
if: github.ref == 'refs/heads/main'
run: npm -g install @semantic-release/git [email protected]
- name: Semantic Release
if: github.ref == 'refs/heads/main' # especificar rama principal
if: github.ref == 'refs/heads/main'
run: npx [email protected]
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} # debe crear un Personal Access Token
- uses: actions/checkout@v3
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/updater.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: updater
on:
schedule:
- cron: '0 12 * * 5' # every Friday at 07:00 Colombia Time
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID_ADMIN_GITHUB }}
private_key: ${{ secrets.APP_PRIVATE_KEY_ADMIN_GITHUB }}
- uses: actions/checkout@v4
with:
ref: main
token: ${{ steps.generate_token.outputs.token }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Check for updates
run: ./gradlew internalTask --action UPDATE_DEPENDENCIES
- name: Check for changes
id: git_changes
run: |
git diff --name-only
if [[ $(git diff --name-only) ]]; then
echo "Changes detected!"
echo "HAS_CHANGES=true" >> $GITHUB_ENV
else
echo "No changes detected!"
echo "HAS_CHANGES=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.HAS_CHANGES == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.generate_token.outputs.token }}
committer: Dependencies Bot <[email protected]>
commit-message: 'fix(deps): update dependencies'
title: 'fix(deps): update dependencies'
body: 'This PR updates dependencies to latest versions'
branch: 'feature/autoupdate-deps'
base: 'main'
labels: 'dependencies'
reviewers: 'juancgalvis'
14 changes: 6 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ buildscript {
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/snapshot" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("com.github.ben-manes:gradle-versions-plugin:$gradleVersionsVersion")
classpath("org.owasp:dependency-check-gradle:${owaspDependencyCheckVersion}")
}
}

plugins {
id "org.sonarqube" version "4.4.1.3373"
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id 'org.sonarqube' version '4.4.1.3373'
id 'com.github.ben-manes.versions' version '0.47.0'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'org.springframework.boot' version '3.2.4' apply false
id 'org.owasp.dependencycheck' version '9.0.9' apply false
id 'co.com.bancolombia.cleanArchitecture' version '3.17.1'
}

apply from: './main.gradle'
apply plugin: 'com.github.ben-manes.versions'
2 changes: 1 addition & 1 deletion commons-jms-api/commons-jms-api.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
api 'jakarta.jms:jakarta.jms-api:' + jsmAPI
api 'jakarta.jms:jakarta.jms-api:3.1.0'
}

ext {
Expand Down
3 changes: 1 addition & 2 deletions commons-jms-mq/commons-jms-mq.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies {
api project(':commons-jms-utils')
api 'com.ibm.mq:mq-jms-spring-boot-starter:' + mqJMSVersion
api 'com.ibm.mq:mq-jms-spring-boot-starter:3.2.4'
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
implementation 'org.springframework.boot:spring-boot-actuator'
}
Expand All @@ -15,4 +15,3 @@ ext {
artifactId = 'commons-jms-mq'
artifactDescription = 'Commons JMS MQ'
}

6 changes: 3 additions & 3 deletions commons-jms-utils/commons-jms-utils.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dependencies {
api project(':commons-jms-api')
implementation "org.apache.commons:commons-lang3:${commonsLang}"
implementation "io.github.resilience4j:resilience4j-retry:${resilience4j}"
implementation "org.apache.logging.log4j:log4j-api:${loggingVersion}"
implementation 'org.apache.commons:commons-lang3:3.14.0'
implementation "io.github.resilience4j:resilience4j-retry:2.2.0"
implementation "org.apache.logging.log4j:log4j-api:2.23.1"
}

ext {
Expand Down
6 changes: 1 addition & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ version=2.2.4
springBootVersion=3.2.4
gradleVersionsVersion=0.47.0
owaspDependencyCheckVersion=9.0.9
mqJMSVersion=3.2.4
jsmAPI=3.1.0
commonsLang=3.14.0
resilience4j=2.2.0
loggingVersion=2.23.1
toPublish=commons-jms-api,commons-jms-utils,commons-jms-mq,commons-jms-http-replier
onlyUpdater=true
2 changes: 1 addition & 1 deletion main.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,4 @@ tasks.register('generateMergedReport', JacocoReport) {

tasks.named('wrapper') {
gradleVersion = '8.5'
}
}