mirror of
https://github.com/s4u/maven-settings-action.git
synced 2026-02-18 00:00:26 +08:00
Merge remote-tracking branch 'origin/master' into releases/v2
This commit is contained in:
4
.github/workflows/audit.yml
vendored
4
.github/workflows/audit.yml
vendored
@ -17,9 +17,9 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.4
|
- uses: actions/checkout@v2.4.0
|
||||||
|
|
||||||
- uses: actions/setup-node@v2.4.0
|
- uses: actions/setup-node@v2.5.1
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
|
|
||||||
|
|||||||
29
.github/workflows/auto-approve.yml
vendored
29
.github/workflows/auto-approve.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Auto approve
|
name: Auto Approve
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target
|
pull_request_target
|
||||||
@ -8,18 +8,27 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: alexwilson/enable-github-automerge-action@1.0.0
|
- name: Dependabot metadata
|
||||||
if: >
|
if: github.actor == 'dependabot[bot]'
|
||||||
github.actor == 'dependabot[bot]'
|
id: dependabot-metadata
|
||||||
|| github.actor == 'dependabot-preview[bot]'
|
uses: dependabot/fetch-metadata@v1.1.1
|
||||||
with:
|
with:
|
||||||
merge-method: "REBASE"
|
|
||||||
github-token: "${{ secrets.TECH_TOKEN }}"
|
github-token: "${{ secrets.TECH_TOKEN }}"
|
||||||
|
|
||||||
- uses: hmarr/auto-approve-action@v2.1.0
|
- name: Enable auto-merge for Dependabot PRs
|
||||||
|
if: >
|
||||||
|
github.actor == 'dependabot[bot]'
|
||||||
|
&& steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'
|
||||||
|
run: gh pr merge --auto --rebase "$PR_URL"
|
||||||
|
env:
|
||||||
|
PR_URL: ${{github.event.pull_request.html_url}}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.TECH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Approve a PR
|
||||||
if: >
|
if: >
|
||||||
github.actor == 'dependabot[bot]'
|
github.actor == 'dependabot[bot]'
|
||||||
|| github.actor == 'dependabot-preview[bot]'
|
|
||||||
|| github.actor == 'slawekjaranowski'
|
|| github.actor == 'slawekjaranowski'
|
||||||
with:
|
run: gh pr review --approve "$PR_URL"
|
||||||
github-token: "${{ secrets.TECH_TOKEN }}"
|
env:
|
||||||
|
PR_URL: ${{github.event.pull_request.html_url}}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.TECH_TOKEN }}
|
||||||
|
|||||||
3
.github/workflows/release-drafter.yml
vendored
3
.github/workflows/release-drafter.yml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
|
- 'main'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update_release_draft:
|
update_release_draft:
|
||||||
@ -16,6 +17,6 @@ jobs:
|
|||||||
&& !startsWith(github.event.head_commit.message , '[maven-release-plugin]')
|
&& !startsWith(github.event.head_commit.message , '[maven-release-plugin]')
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: release-drafter/release-drafter@v5.15.0
|
- uses: release-drafter/release-drafter@v5.18.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -17,13 +17,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.4
|
- uses: actions/checkout@v2.4.0
|
||||||
|
|
||||||
- uses: actions/setup-node@v2.4.0
|
- uses: actions/setup-node@v2.5.1
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
|
|
||||||
- uses: actions/setup-java@v2.2.0
|
- uses: actions/setup-java@v2.5.0
|
||||||
with:
|
with:
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|||||||
34
README.md
34
README.md
@ -19,27 +19,33 @@ This project uses [Semantic Versioning](https://semver.org/).
|
|||||||
We recommended to use the latest and specific release version.
|
We recommended to use the latest and specific release version.
|
||||||
|
|
||||||
In order to keep your project dependencies up to date you can watch this repository *(Releases only)*
|
In order to keep your project dependencies up to date you can watch this repository *(Releases only)*
|
||||||
or use automatic tools like [Dependabot](https://dependabot.com/).
|
or use automatic tools like [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates).
|
||||||
|
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
|
You can try our action [Setup Maven Action](https://github.com/marketplace/actions/setup-maven-action) for completely maven environment setup.
|
||||||
|
|
||||||
See [action.yml](action.yml)
|
See [action.yml](action.yml)
|
||||||
|
|
||||||
## default ```settings.xml```
|
## default ```settings.xml```
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
```
|
```
|
||||||
|
|
||||||
## ```settings.xml``` with servers section
|
## ```settings.xml``` with servers section
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Also you can use `path` argument if your settings.xml is stored in different location.
|
||||||
|
|
||||||
|
|
||||||
All `server` attributes may be specified:
|
All `server` attributes may be specified:
|
||||||
* `id` _(required)_
|
* `id` _(required)_
|
||||||
* `username`
|
* `username`
|
||||||
@ -56,7 +62,7 @@ Please refer to the [servers](http://maven.apache.org/settings.html#Servers) doc
|
|||||||
|
|
||||||
``` yml
|
``` yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
servers: |
|
servers: |
|
||||||
[{
|
[{
|
||||||
@ -90,7 +96,7 @@ result will be:
|
|||||||
## ```settings.xml``` with mirrors section
|
## ```settings.xml``` with mirrors section
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
|
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
|
||||||
```
|
```
|
||||||
@ -98,7 +104,7 @@ steps:
|
|||||||
## ```settings.xml``` with properties
|
## ```settings.xml``` with properties
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
||||||
```
|
```
|
||||||
@ -107,7 +113,7 @@ steps:
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
sonatypeSnapshots: true
|
sonatypeSnapshots: true
|
||||||
```
|
```
|
||||||
@ -116,7 +122,7 @@ steps:
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
apacheSnapshots: true
|
apacheSnapshots: true
|
||||||
```
|
```
|
||||||
@ -124,7 +130,7 @@ steps:
|
|||||||
## Do not override existing ```settings.xml```, from version **2.0** file is override by default :
|
## Do not override existing ```settings.xml```, from version **2.0** file is override by default :
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
override: false
|
override: false
|
||||||
```
|
```
|
||||||
@ -132,7 +138,7 @@ steps:
|
|||||||
## Do not add github to server in ```settings.xml```, by default is added:
|
## Do not add github to server in ```settings.xml```, by default is added:
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
githubServer: false
|
githubServer: false
|
||||||
```
|
```
|
||||||
@ -141,7 +147,7 @@ steps:
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
oracleServers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
oracleServers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||||
```
|
```
|
||||||
@ -149,7 +155,7 @@ steps:
|
|||||||
## ```settings.xml``` with [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017)
|
## ```settings.xml``` with [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017)
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
oracleRepo: true
|
oracleRepo: true
|
||||||
```
|
```
|
||||||
@ -160,7 +166,7 @@ It is also possible pass in Github Secrets e.g.
|
|||||||
|
|
||||||
``` yml
|
``` yml
|
||||||
steps:
|
steps:
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
with:
|
with:
|
||||||
servers: |
|
servers: |
|
||||||
[{
|
[{
|
||||||
@ -190,7 +196,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
java-version: 8
|
java-version: 8
|
||||||
|
|
||||||
- uses: s4u/maven-settings-action@v2.4.1
|
- uses: s4u/maven-settings-action@v2.5.0
|
||||||
|
|
||||||
- run: mvn verify
|
- run: mvn verify
|
||||||
```
|
```
|
||||||
|
|||||||
@ -6,6 +6,9 @@ branding:
|
|||||||
color: 'green'
|
color: 'green'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
|
path:
|
||||||
|
description: 'override default path to settings.xml which is $HOME/.m2/settings.xml'
|
||||||
|
required: false
|
||||||
servers:
|
servers:
|
||||||
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
|
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
3681
package-lock.json
generated
3681
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "maven-settings-action",
|
"name": "maven-settings-action",
|
||||||
"version": "2.4.1",
|
"version": "2.5.0",
|
||||||
"description": "Prepare maven settings",
|
"description": "Prepare maven settings",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -26,11 +26,11 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/s4u/maven-settings-action#readme",
|
"homepage": "https://github.com/s4u/maven-settings-action#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.5.0",
|
"@actions/core": "^1.6.0",
|
||||||
"@xmldom/xmldom": "^0.7.1"
|
"@xmldom/xmldom": "^0.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^8.8.0",
|
||||||
"jest": "^27.0.6"
|
"jest": "^27.4.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,12 @@ const DOMParser = require('@xmldom/xmldom').DOMParser;
|
|||||||
const XMLSerializer = require('@xmldom/xmldom').XMLSerializer;
|
const XMLSerializer = require('@xmldom/xmldom').XMLSerializer;
|
||||||
|
|
||||||
function getSettingsPath() {
|
function getSettingsPath() {
|
||||||
|
const _path = core.getInput('path');
|
||||||
|
if (!_path) {
|
||||||
return path.join(os.homedir(), '.m2', 'settings.xml');
|
return path.join(os.homedir(), '.m2', 'settings.xml');
|
||||||
|
} else {
|
||||||
|
return _path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTemplate(templateName) {
|
function getTemplate(templateName) {
|
||||||
|
|||||||
@ -689,3 +689,18 @@ test('genereate - override', () => {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('generate - custom path', () => {
|
||||||
|
|
||||||
|
if (!fs.existsSync(testHomePath)) {
|
||||||
|
fs.mkdirSync(testHomePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
const mySettings = path.join(testHomePath, 'settings_custom.xml');
|
||||||
|
process.env['INPUT_PATH'] = mySettings;
|
||||||
|
settings.generate();
|
||||||
|
|
||||||
|
const settingsStatus = fs.lstatSync(mySettings);
|
||||||
|
expect(settingsStatus.isFile()).toBeTruthy();
|
||||||
|
expect(settingsStatus.size).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user