From 844870199e1e1fe420a61d9bc4fff75a2efdff26 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Thu, 8 Jun 2023 08:15:09 -0400 Subject: [PATCH 01/11] ci: add linting job --- .github/workflows/build.yml | 5 + .gitignore | 4 +- .vscode/code-style.xml | 337 ++++++++++++++++++++++++++++++++++++ pom.xml | 53 ++++-- 4 files changed, 383 insertions(+), 16 deletions(-) create mode 100644 .vscode/code-style.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1768f2ff..493522ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,10 +15,15 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up JDK 11 uses: actions/setup-java@v2 with: java-version: '11' distribution: 'adopt' + + - name: Validate code format + run: mvn formatter:validate + - name: Build with Maven run: mvn -B package --file pom.xml diff --git a/.gitignore b/.gitignore index d5a7ca72..43e8b80c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /target/ .env /.idea/ -.vscode \ No newline at end of file +.vscode/* + +!.vscode/code-style.xml \ No newline at end of file diff --git a/.vscode/code-style.xml b/.vscode/code-style.xml new file mode 100644 index 00000000..7bb6804e --- /dev/null +++ b/.vscode/code-style.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 142e7175..8dd72cc1 100644 --- a/pom.xml +++ b/pom.xml @@ -49,26 +49,49 @@ + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + + + attach-sources + + jar-no-fork + + + + + + + + net.revelc.code.formatter + formatter-maven-plugin + + .vscode/code-style.xml + LF + + + + + format + + + + + + + + release - - org.apache.maven.plugins - maven-source-plugin - 3.0.0 - - - - - attach-sources - - jar-no-fork - - - - org.apache.maven.plugins maven-javadoc-plugin From 9b34fd2ff26ce106be74fcace659231693167044 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Thu, 8 Jun 2023 08:26:56 -0400 Subject: [PATCH 02/11] docs: add formatting instructions in readme --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 4d0a54e0..d569f2d8 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,20 @@ public class PushOneDocument { ``` +## Local Setup to Contribute + +### Formatting +Make sure to format your code before each pull request by manually invoking the [formatter-maven-plugin](https://code.revelc.net/formatter-maven-plugin/) Java plugin: +```bash +mvn formatter:format +``` + +You could also configure your IDE to use `.vscode/code-style.xml` for the formatting rules. +In VSCode, you can either update `~/Library/Application Support/Code/User/settings.json` or `.vscode/settings.json` by adding the following instruction: +```json +"java.format.settings.url": ".vscode/code-style.xml" +``` + ## Release * Tag the commit following semver. From 03c978c810cde98074b8338a758c0bdf78abd0d3 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Thu, 8 Jun 2023 09:14:14 -0400 Subject: [PATCH 03/11] ci: change indentation --- .vscode/code-style.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/code-style.xml b/.vscode/code-style.xml index 7bb6804e..bb335f00 100644 --- a/.vscode/code-style.xml +++ b/.vscode/code-style.xml @@ -167,7 +167,7 @@ - + From 69e7f2d693f1259450ea9f79ab5317fd6c34ab96 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Fri, 9 Jun 2023 08:25:52 -0400 Subject: [PATCH 04/11] draft workflows --- .github/workflows/auto-approve-renovate.yml | 19 +++++++++ .github/workflows/maven-publish.yml | 32 +++++++++++++++ .github/workflows/release.yml | 34 ++++++++++++++++ pom.xml | 43 ++++----------------- 4 files changed, 92 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/auto-approve-renovate.yml create mode 100644 .github/workflows/maven-publish.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/auto-approve-renovate.yml b/.github/workflows/auto-approve-renovate.yml new file mode 100644 index 00000000..9b18e652 --- /dev/null +++ b/.github/workflows/auto-approve-renovate.yml @@ -0,0 +1,19 @@ +name: Automated approval + +on: + pull_request: + types: + - opened + - reopened + - labeled + +jobs: + auto-approve: + runs-on: ubuntu-latest + if: (github.actor == 'TODO:') && (contains(join(github.event.pull_request.labels.*.name), 'snpashot')) + steps: + - name: auto-approve + id: auto-approve + uses: coveo/actions/auto-approve-action@main + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 00000000..89f9a7fe --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,32 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path + +name: Maven Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + server-id: github + + - name: Build with Maven + run: mvn -B clean package --file pom.xml + + - name: Publish to GitHub Packages Apache Maven + run: mvn deploy + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..f3da129c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: Create release + +on: + push: + branches: + - master + +permissions: + contents: write + pull-requests: write + +jobs: + release: + runs-on: ubuntu-latest + environment: CD + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Build + run: mvn clean package + + - uses: google-github-actions/release-please-action@v3 + with: + release-type: maven + package-name: release-please-action + default-branch: master + pull-request-title-pattern: 'chore${scope}: release${component} ${version} [skip-ci]' + # TODO: create PAT + token: ${{ secrets.RELEASE_KEY }} diff --git a/pom.xml b/pom.xml index 8dd72cc1..793b49f5 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.coveo @@ -39,13 +39,10 @@ - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ + github + GitHub Packages + ${github.packages.url} @@ -67,22 +64,6 @@ - - - net.revelc.code.formatter - formatter-maven-plugin - - .vscode/code-style.xml - LF - - - - - format - - - - @@ -108,17 +89,6 @@ - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.6 - true - - ossrh - https://oss.sonatype.org/ - true - - org.apache.maven.plugins maven-gpg-plugin @@ -177,9 +147,9 @@ commons-codec 1.9 + - jboss-community @@ -192,5 +162,6 @@ 11 11 UTF-8 + https://maven.pkg.github.com/coveo/push-api-client.java \ No newline at end of file From b27eb59dff1ea1ee771221337b6a36c178a46917 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Mon, 12 Jun 2023 10:59:26 -0400 Subject: [PATCH 05/11] get installation token --- .github/workflows/pr-title-semantic-lint.yml | 4 +- .github/workflows/release.yml | 11 +- .gitignore | 4 +- .vscode/code-style.xml | 337 --------------- package-lock.json | 431 ++++++++++++++++++- package.json | 6 +- pom.xml | 6 +- utils/get-token.mjs | 18 + 8 files changed, 461 insertions(+), 356 deletions(-) delete mode 100644 .vscode/code-style.xml create mode 100644 utils/get-token.mjs diff --git a/.github/workflows/pr-title-semantic-lint.yml b/.github/workflows/pr-title-semantic-lint.yml index 96bf265e..2f50d6ed 100644 --- a/.github/workflows/pr-title-semantic-lint.yml +++ b/.github/workflows/pr-title-semantic-lint.yml @@ -1,11 +1,11 @@ name: PrTitleSemanticLint on: pull_request: - branches: [master] + branches: [main] types: [opened, edited, synchronize, reopened] jobs: Lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3da129c..d058fd92 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,11 +3,7 @@ name: Create release on: push: branches: - - master - -permissions: - contents: write - pull-requests: write + - main jobs: release: @@ -28,7 +24,6 @@ jobs: with: release-type: maven package-name: release-please-action - default-branch: master + default-branch: main pull-request-title-pattern: 'chore${scope}: release${component} ${version} [skip-ci]' - # TODO: create PAT - token: ${{ secrets.RELEASE_KEY }} + token: $RELEASE_TOKEN diff --git a/.gitignore b/.gitignore index aee85415..5fc3f8c0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,4 @@ node_modules /target/ .env /.idea/ -.vscode/* - -!.vscode/code-style.xml \ No newline at end of file +.vscode \ No newline at end of file diff --git a/.vscode/code-style.xml b/.vscode/code-style.xml deleted file mode 100644 index bb335f00..00000000 --- a/.vscode/code-style.xml +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/package-lock.json b/package-lock.json index 62b17eaf..0d5612dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,28 @@ "version": "1.0.0", "license": "Apache-2.0", "devDependencies": { - "@commitlint/config-conventional": "17.4.4" + "@actions/core": "^1.10.0", + "@commitlint/config-conventional": "17.4.4", + "@octokit/auth-app": "^4.0.9" + } + }, + "node_modules/@actions/core": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", + "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", + "dev": true, + "dependencies": { + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" + } + }, + "node_modules/@actions/http-client": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz", + "integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==", + "dev": true, + "dependencies": { + "tunnel": "^0.0.6" } }, "node_modules/@commitlint/config-conventional": { @@ -24,12 +45,200 @@ "node": ">=v14" } }, + "node_modules/@octokit/auth-app": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-4.0.13.tgz", + "integrity": "sha512-NBQkmR/Zsc+8fWcVIFrwDgNXS7f4XDrkd9LHdi9DPQw1NdGHLviLzRO2ZBwTtepnwHXW5VTrVU9eFGijMUqllg==", + "dev": true, + "dependencies": { + "@octokit/auth-oauth-app": "^5.0.0", + "@octokit/auth-oauth-user": "^2.0.0", + "@octokit/request": "^6.0.0", + "@octokit/request-error": "^3.0.0", + "@octokit/types": "^9.0.0", + "deprecation": "^2.3.1", + "lru-cache": "^9.0.0", + "universal-github-app-jwt": "^1.1.1", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@octokit/auth-oauth-app": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-5.0.6.tgz", + "integrity": "sha512-SxyfIBfeFcWd9Z/m1xa4LENTQ3l1y6Nrg31k2Dcb1jS5ov7pmwMJZ6OGX8q3K9slRgVpeAjNA1ipOAMHkieqyw==", + "dev": true, + "dependencies": { + "@octokit/auth-oauth-device": "^4.0.0", + "@octokit/auth-oauth-user": "^2.0.0", + "@octokit/request": "^6.0.0", + "@octokit/types": "^9.0.0", + "@types/btoa-lite": "^1.0.0", + "btoa-lite": "^1.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@octokit/auth-oauth-device": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-4.0.5.tgz", + "integrity": "sha512-XyhoWRTzf2ZX0aZ52a6Ew5S5VBAfwwx1QnC2Np6Et3MWQpZjlREIcbcvVZtkNuXp6Z9EeiSLSDUqm3C+aMEHzQ==", + "dev": true, + "dependencies": { + "@octokit/oauth-methods": "^2.0.0", + "@octokit/request": "^6.0.0", + "@octokit/types": "^9.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@octokit/auth-oauth-user": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-2.1.2.tgz", + "integrity": "sha512-kkRqNmFe7s5GQcojE3nSlF+AzYPpPv7kvP/xYEnE57584pixaFBH8Vovt+w5Y3E4zWUEOxjdLItmBTFAWECPAg==", + "dev": true, + "dependencies": { + "@octokit/auth-oauth-device": "^4.0.0", + "@octokit/oauth-methods": "^2.0.0", + "@octokit/request": "^6.0.0", + "@octokit/types": "^9.0.0", + "btoa-lite": "^1.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@octokit/endpoint": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.6.tgz", + "integrity": "sha512-5L4fseVRUsDFGR00tMWD/Trdeeihn999rTMGRMC1G/Ldi1uWlWJzI98H4Iak5DB/RVvQuyMYKqSK/R6mbSOQyg==", + "dev": true, + "dependencies": { + "@octokit/types": "^9.0.0", + "is-plain-object": "^5.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@octokit/oauth-authorization-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-5.0.0.tgz", + "integrity": "sha512-y1WhN+ERDZTh0qZ4SR+zotgsQUE1ysKnvBt1hvDRB2WRzYtVKQjn97HEPzoehh66Fj9LwNdlZh+p6TJatT0zzg==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@octokit/oauth-methods": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-2.0.6.tgz", + "integrity": "sha512-l9Uml2iGN2aTWLZcm8hV+neBiFXAQ9+3sKiQe/sgumHlL6HDg0AQ8/l16xX/5jJvfxueqTW5CWbzd0MjnlfHZw==", + "dev": true, + "dependencies": { + "@octokit/oauth-authorization-url": "^5.0.0", + "@octokit/request": "^6.2.3", + "@octokit/request-error": "^3.0.3", + "@octokit/types": "^9.0.0", + "btoa-lite": "^1.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-18.0.0.tgz", + "integrity": "sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw==", + "dev": true + }, + "node_modules/@octokit/request": { + "version": "6.2.5", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-6.2.5.tgz", + "integrity": "sha512-z83E8UIlPNaJUsXpjD8E0V5o/5f+vJJNbNcBwVZsX3/vC650U41cOkTLjq4PKk9BYonQGOnx7N17gvLyNjgGcQ==", + "dev": true, + "dependencies": { + "@octokit/endpoint": "^7.0.0", + "@octokit/request-error": "^3.0.0", + "@octokit/types": "^9.0.0", + "is-plain-object": "^5.0.0", + "node-fetch": "^2.6.7", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@octokit/request-error": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.3.tgz", + "integrity": "sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^9.0.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@octokit/types": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-9.3.1.tgz", + "integrity": "sha512-zfJzyXLHC42sWcn2kS+oZ/DRvFZBYCCbfInZtwp1Uopl1qh6pRg4NSP/wFX1xCOpXvEkctiG1sxlSlkZmzvxdw==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^18.0.0" + } + }, + "node_modules/@types/btoa-lite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/btoa-lite/-/btoa-lite-1.0.0.tgz", + "integrity": "sha512-wJsiX1tosQ+J5+bY5LrSahHxr2wT+uME5UDwdN1kg4frt40euqA+wzECkmq4t5QbveHiJepfdThgQrPw6KiSlg==", + "dev": true + }, + "node_modules/@types/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "20.3.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.0.tgz", + "integrity": "sha512-cumHmIAf6On83X7yP+LrsEyUOf/YlociZelmpRYaGFydoaPdxdt80MAbu6vWerQT2COCp2nPvHdsbD7tHn/YlQ==", + "dev": true + }, "node_modules/array-ify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", "dev": true }, + "node_modules/btoa-lite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", + "integrity": "sha512-gvW7InbIyF8AicrqWoptdW08pUxuhq8BEgowNajy9RhiE86fmGAGl+bLKo6oB8QP0CkqHLowfN0oJdKC/J6LbA==", + "dev": true + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "dev": true + }, "node_modules/compare-func": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", @@ -54,6 +263,12 @@ "node": ">=10" } }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true + }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -66,6 +281,15 @@ "node": ">=8" } }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", @@ -75,12 +299,102 @@ "node": ">=8" } }, + "node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jsonwebtoken": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", + "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", + "dev": true, + "dependencies": { + "jws": "^3.2.2", + "lodash": "^4.17.21", + "ms": "^2.1.1", + "semver": "^7.3.8" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dev": true, + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dev": true, + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "node_modules/lru-cache": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.2.tgz", + "integrity": "sha512-ERJq3FOzJTxBbFjZ7iDs+NiK4VI9Wz+RdrrAB8dio1oV+YvdPzUEE4QNiT2VD51DkIbCYRUUzCRkssXCHqSnKQ==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, "node_modules/q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -90,6 +404,121 @@ "node": ">=0.6.0", "teleport": ">=0.2.0" } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "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/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/semver": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true + }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "dev": true, + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, + "node_modules/universal-github-app-jwt": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-1.1.1.tgz", + "integrity": "sha512-G33RTLrIBMFmlDV4u4CBF7dh71eWwykck4XgaxaIVeZKOYZRAAxvcGMRFTUclVY6xoUPQvO4Ne5wKGxYm/Yy9w==", + "dev": true, + "dependencies": { + "@types/jsonwebtoken": "^9.0.0", + "jsonwebtoken": "^9.0.0" + } + }, + "node_modules/universal-user-agent": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==", + "dev": true + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } } diff --git a/package.json b/package.json index e946eeb3..02c9536a 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,13 @@ "description": "CI related stuff only", "license": "Apache-2.0", "devDependencies": { - "@commitlint/config-conventional": "17.4.4" + "@actions/core": "^1.10.0", + "@commitlint/config-conventional": "17.4.4", + "@octokit/auth-app": "^4.0.9" }, "commitlint": { "extends": [ "@commitlint/config-conventional" ] } -} \ No newline at end of file +} diff --git a/pom.xml b/pom.xml index cccd73d6..008ede3a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.coveo @@ -164,9 +164,9 @@ commons-codec 1.9 - + jboss-community diff --git a/utils/get-token.mjs b/utils/get-token.mjs new file mode 100644 index 00000000..1660f6ad --- /dev/null +++ b/utils/get-token.mjs @@ -0,0 +1,18 @@ +import {createAppAuth} from '@octokit/auth-app'; +import {setSecret} from '@actions/core' + +const auth = createAppAuth({ + appId: process.env.RELEASER_APP_ID, + privateKey: process.env.RELEASER_PRIVATE_KEY, + clientId: process.env.RELEASER_CLIENT_ID, + clientSecret: process.env.RELEASER_CLIENT_SECRET, +}); + +// Retrieve installation access token +const {token} = await auth({ + type: 'installation', + installationId: process.env.RELEASER_INSTALLATION_ID, +}); + +setSecret(token); +exportVariable('RELEASE_TOKEN', token); \ No newline at end of file From d540936494bbda7781aac47f207134e1c973d3cb Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Mon, 12 Jun 2023 11:04:36 -0400 Subject: [PATCH 06/11] update github actor condition --- .github/workflows/auto-approve-renovate.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-approve-renovate.yml b/.github/workflows/auto-approve-renovate.yml index 9b18e652..1ef4f095 100644 --- a/.github/workflows/auto-approve-renovate.yml +++ b/.github/workflows/auto-approve-renovate.yml @@ -10,7 +10,7 @@ on: jobs: auto-approve: runs-on: ubuntu-latest - if: (github.actor == 'TODO:') && (contains(join(github.event.pull_request.labels.*.name), 'snpashot')) + if: (github.actor == 'developer-experience-bot[bot]') && (contains(join(github.event.pull_request.labels.*.name), 'snpashot')) steps: - name: auto-approve id: auto-approve diff --git a/package.json b/package.json index 02c9536a..767f22ba 100644 --- a/package.json +++ b/package.json @@ -15,4 +15,4 @@ "@commitlint/config-conventional" ] } -} +} \ No newline at end of file From 011998a6a46a6a2885e25dbabfeabf575b120994 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Mon, 12 Jun 2023 11:19:33 -0400 Subject: [PATCH 07/11] ci: add get-token script --- .github/workflows/release.yml | 17 +++++++++++++++-- package.json | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d058fd92..4bd1d892 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,19 +8,32 @@ on: jobs: release: runs-on: ubuntu-latest - environment: CD + environment: 'Release' steps: - uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install dependencies + run: npm ci + + - name: Get Release Token + run: npm run get-token + - uses: actions/setup-java@v3 + name: Set up Java with: java-version: '11' distribution: 'adopt' - - name: Build + - name: Build Java package run: mvn clean package - uses: google-github-actions/release-please-action@v3 + name: Release Java package with: release-type: maven package-name: release-please-action diff --git a/package.json b/package.json index 767f22ba..f76a7165 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "publish-java-package-with-maven-on-github-packages", "private": true, + "type": "module", "version": "1.0.0", "author": "Coveo", "description": "CI related stuff only", @@ -10,6 +11,9 @@ "@commitlint/config-conventional": "17.4.4", "@octokit/auth-app": "^4.0.9" }, + "scripts": { + "get-token": "node get-token.mjs" + }, "commitlint": { "extends": [ "@commitlint/config-conventional" From 54346089beda1534e8386a781f4d1660496702b4 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Mon, 12 Jun 2023 13:42:12 -0400 Subject: [PATCH 08/11] ci: bump node version --- .github/workflows/maven-publish.yml | 2 ++ .github/workflows/release.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 89f9a7fe..e120740f 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -4,6 +4,8 @@ name: Maven Package on: + # TODO: remove after release. This is a fail safe in case this workflow does not get triggered + workflow_dispatch: release: types: [created] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4bd1d892..f8e389a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '18' - name: Install dependencies run: npm ci From 0154a803694710a315eaa77fe95608a1a772a36b Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Mon, 12 Jun 2023 14:38:14 -0400 Subject: [PATCH 09/11] chore: bump com.google.code.gson --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 008ede3a..62e78f9e 100644 --- a/pom.xml +++ b/pom.xml @@ -135,7 +135,7 @@ com.google.code.gson gson - 2.8.7 + 2.8.9 io.github.cdimascio From e4df8270f59043defa600bf72b2a05b230e234a4 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Mon, 12 Jun 2023 14:42:37 -0400 Subject: [PATCH 10/11] update versions --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 62e78f9e..2dad2236 100644 --- a/pom.xml +++ b/pom.xml @@ -156,13 +156,13 @@ junit junit - 4.12 + 4.13 test commons-codec commons-codec - 1.9 + 1.15 From 2bfeab273dd0949eb66a363f819e2498861c23b4 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Mon, 12 Jun 2023 14:44:01 -0400 Subject: [PATCH 11/11] bump junit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2dad2236..513e61ab 100644 --- a/pom.xml +++ b/pom.xml @@ -156,7 +156,7 @@ junit junit - 4.13 + 4.13.1 test