mirror of
https://github.com/s4u/maven-settings-action.git
synced 2026-02-15 00:00:30 +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 }}
|
||||
|
||||
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:
|
||||
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:
|
||||
pull_request_target
|
||||
@ -8,18 +8,27 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- uses: alexwilson/enable-github-automerge-action@1.0.0
|
||||
if: >
|
||||
github.actor == 'dependabot[bot]'
|
||||
|| github.actor == 'dependabot-preview[bot]'
|
||||
- name: Dependabot metadata
|
||||
if: github.actor == 'dependabot[bot]'
|
||||
id: dependabot-metadata
|
||||
uses: dependabot/fetch-metadata@v1.1.1
|
||||
with:
|
||||
merge-method: "REBASE"
|
||||
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: >
|
||||
github.actor == 'dependabot[bot]'
|
||||
|| github.actor == 'dependabot-preview[bot]'
|
||||
|| github.actor == 'slawekjaranowski'
|
||||
with:
|
||||
github-token: "${{ secrets.TECH_TOKEN }}"
|
||||
run: gh pr review --approve "$PR_URL"
|
||||
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:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
@ -16,6 +17,6 @@ jobs:
|
||||
&& !startsWith(github.event.head_commit.message , '[maven-release-plugin]')
|
||||
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5.15.0
|
||||
- uses: release-drafter/release-drafter@v5.18.0
|
||||
env:
|
||||
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 }}
|
||||
|
||||
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:
|
||||
node-version: '12.x'
|
||||
|
||||
- uses: actions/setup-java@v2.2.0
|
||||
- uses: actions/setup-java@v2.5.0
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
## default ```settings.xml```
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
```
|
||||
|
||||
## ```settings.xml``` with servers section
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
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:
|
||||
* `id` _(required)_
|
||||
* `username`
|
||||
@ -56,7 +62,7 @@ Please refer to the [servers](http://maven.apache.org/settings.html#Servers) doc
|
||||
|
||||
``` yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
servers: |
|
||||
[{
|
||||
@ -90,7 +96,7 @@ result will be:
|
||||
## ```settings.xml``` with mirrors section
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
|
||||
```
|
||||
@ -98,7 +104,7 @@ steps:
|
||||
## ```settings.xml``` with properties
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
||||
```
|
||||
@ -107,7 +113,7 @@ steps:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
sonatypeSnapshots: true
|
||||
```
|
||||
@ -116,7 +122,7 @@ steps:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
apacheSnapshots: true
|
||||
```
|
||||
@ -124,7 +130,7 @@ steps:
|
||||
## Do not override existing ```settings.xml```, from version **2.0** file is override by default :
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
override: false
|
||||
```
|
||||
@ -132,7 +138,7 @@ steps:
|
||||
## Do not add github to server in ```settings.xml```, by default is added:
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
githubServer: false
|
||||
```
|
||||
@ -141,7 +147,7 @@ steps:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
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)
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
oracleRepo: true
|
||||
```
|
||||
@ -160,7 +166,7 @@ It is also possible pass in Github Secrets e.g.
|
||||
|
||||
``` yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
with:
|
||||
servers: |
|
||||
[{
|
||||
@ -190,7 +196,7 @@ steps:
|
||||
with:
|
||||
java-version: 8
|
||||
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v2.5.0
|
||||
|
||||
- run: mvn verify
|
||||
```
|
||||
|
||||
@ -6,6 +6,9 @@ branding:
|
||||
color: 'green'
|
||||
|
||||
inputs:
|
||||
path:
|
||||
description: 'override default path to settings.xml which is $HOME/.m2/settings.xml'
|
||||
required: false
|
||||
servers:
|
||||
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
required: false
|
||||
|
||||
3679
package-lock.json
generated
3679
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",
|
||||
"version": "2.4.1",
|
||||
"version": "2.5.0",
|
||||
"description": "Prepare maven settings",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -26,11 +26,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/s4u/maven-settings-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.5.0",
|
||||
"@xmldom/xmldom": "^0.7.1"
|
||||
"@actions/core": "^1.6.0",
|
||||
"@xmldom/xmldom": "^0.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.32.0",
|
||||
"jest": "^27.0.6"
|
||||
"eslint": "^8.8.0",
|
||||
"jest": "^27.4.7"
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,12 @@ const DOMParser = require('@xmldom/xmldom').DOMParser;
|
||||
const XMLSerializer = require('@xmldom/xmldom').XMLSerializer;
|
||||
|
||||
function getSettingsPath() {
|
||||
return path.join(os.homedir(), '.m2', 'settings.xml');
|
||||
const _path = core.getInput('path');
|
||||
if (!_path) {
|
||||
return path.join(os.homedir(), '.m2', 'settings.xml');
|
||||
} else {
|
||||
return _path;
|
||||
}
|
||||
}
|
||||
|
||||
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