Skip to content

Commit

Permalink
Oracle Maven repository
Browse files Browse the repository at this point in the history
fix: #62
  • Loading branch information
slawekjaranowski committed Oct 16, 2020
1 parent ea8b3d6 commit c36b106
Show file tree
Hide file tree
Showing 16 changed files with 488 additions and 182 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.js eol=lf
*.yml eol=lf
*.xml eol=lf
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
properties: '[{"prop1": "value1"}, {"prop2": "value2"}]'
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
sonatypeSnapshots: true
oracleServers: '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]'
oracleRepo: true

- run: cat ~/.m2/settings.xml
shell: bash
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ steps:
githubServer: false
```

Create ```settings.xml``` with special server item configuration for oracle repository [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9015)
```yml
steps:
- uses: s4u/[email protected]
with:
oracleServers: '[{"id": "serverId", "username": "username", "password": "password"}]'
```

Create ```settings.xml``` with [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017)
```yml
steps:
- uses: s4u/[email protected]
with:
oracleRepo: true
```

# License

The scripts and documentation in this project are released under the [MIT License](LICENSE)
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ inputs:
description: 'add to settings.xml servers server-id: github; username=$GITHUB_ACTOR and password=$GITHUB_TOKEN'
default: "true"
required: false


oracleServers:
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}] for Oracle repository'
required: false
oracleRepo:
description: 'add Oracle Maven Repository'
default: "false"
required: false

runs:
using: 'node12'
Expand Down
126 changes: 120 additions & 6 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,132 @@ afterAll(() => {

test('run with all feature', () => {

process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "username", "password": "password"}]';
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "sUsername", "password": "sPassword"}]';
process.env['INPUT_ORACLESERVERS'] = '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]';
process.env['INPUT_GITHUBSERVER'] = true;

process.env['INPUT_MIRRORS'] = '[{"id": "mirrorId", "name": "mirror Name", "mirrorOf": "mirror Off *", "url": "mirror url"}]';
process.env['INPUT_PROPERTIES'] = '[{"prop1": "value1"}, {"prop2": "value2"}]'
process.env['INPUT_SONATYPESNAPSHOT'] = true;

cp.execSync(`node ${indexPath}`, { env: process.env }).toString();
process.env['INPUT_SONATYPESNAPSHOTS'] = true;
process.env['INPUT_ORACLEREPO'] = true;

cp.execSync(`node ${indexPath}`, { env: process.env, stdio: 'inherit' });

const settingsStatus = fs.lstatSync(settingsPath);
expect(settingsStatus.isFile()).toBeTruthy();
expect(settingsStatus.size).toBeGreaterThan(0);

const settingsBody = fs.readFileSync(settingsPath).toString();
expect(settingsBody).toMatch('<settings>');
expect(settingsBody).toMatch('<servers><server><id>serverId</id><username>username</username><password>password</password></server></servers>');
expect(settingsBody).toMatch('prop1');
expect(settingsBody).toBe(`<settings>
<interactiveMode>false</interactiveMode>
<profiles>
<profile>
<id>_properties_</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties><prop1>value1</prop1><prop2>value2</prop2></properties>
</profile>
<profile>
<id>_sonatype-snapshots_</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>_maven.oracle.com_</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>maven.oracle.com</id>
<url>https://maven.oracle.com</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven.oracle.com</id>
<url>https://maven.oracle.com</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile></profiles>
<servers>
<server>
<id>serverId</id>
<username>sUsername</username>
<password>sPassword</password>
</server>
<server>
<id>oServerId</id>
<username>oUsername</username>
<password>oPassword</password>
<configuration>
<basicAuthScope>
<host>ANY</host>
<port>ANY</port>
<realm>OAM 11g</realm>
</basicAuthScope>
<httpConfiguration>
<all>
<params>
<property>
<name>http.protocol.allow-circular-redirects</name>
<value>%b,true</value>
</property>
</params>
</all>
</httpConfiguration>
</configuration>
</server>
<server>
<id>github</id>
<username>\${env.GITHUB_ACTOR}</username>
<password>\${env.GITHUB_TOKEN}</password>
</server></servers>
<mirrors>
<mirror>
<id>mirrorId</id>
<name>mirror Name</name>
<mirrorOf>mirror Off *</mirrorOf>
<url>mirror url</url>
</mirror></mirrors>
</settings>`);
})
7 changes: 1 addition & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maven-settings-action",
"version": "1.0.0",
"version": "2.2.0",
"description": "Prepare maven settings",
"main": "index.js",
"scripts": {
Expand All @@ -25,8 +25,7 @@
"homepage": "https://github.com/s4u/maven-settings-action#readme",
"dependencies": {
"@actions/core": "^1.2.6",
"xmldom": "^0.3.0",
"xpath": "0.0.30"
"xmldom": "^0.3.0"
},
"devDependencies": {
"eslint": "^7.11.0",
Expand Down
Loading

0 comments on commit c36b106

Please sign in to comment.