Fixes #85. Add support for multiple server ids.
This PR does not fully address #85; it does not allow the user to specify a list of servers as follows:
server-list:
- server-id: value-of-server-id-1
server-username: SERVER_USERNAME_1
server-password: SERVER_PASSWORD_1
- server-id: value-of-server-id-2
server-username: SERVER_USERNAME_2
server-password: SERVER_PASSWORD_2
As GitHub Actions do not appear to support YAML parameters.
However, it does allow the user to specify a list of server ids as follows:
- name: Step 2 - Setup Java.
uses: drewctaylor/setup-java@actions-setup-java-85-b
with:
java-version: 11
server-id-list: require, type-encoded, github
server-username: SERVER_USERNAME
server-password: SERVER_PASSWORD
- name: Step 3 - Maven Deploy.
run: mvn -B deploy
env:
SERVER_USERNAME: ${{ github.actor }}
SERVER_PASSWORD: ${{ github.token }}
Which produces a settings xml as follows:
<server>
<id>github</id>
<username>value-of-server-username</username>
<password>value-of-server-password</password>
</server>
<server>
<id>require</id>
<username>value-of-server-username</username>
<password>value-of-server-password</password>
</server>
<server>
<id>type-encoded</id>
<username>value-of-server-username</username>
<password>value-of-server-password</password>
</server>
In general, the action concatenates the value of server-id to the value of server-id-list, removes any duplicates, and produces one server entry per value.
For example,
- if the client specifies neither
server-idnorserver-id-list, the action concatenates the default value ofserver-id(github) to the default value ofserver-id-list([github]), producing ([github, github]); the action then removes the duplicategithuband produces oneserverentry for the remaininggithub. - if the client specifies
server-idbut notserver-id-list, the action concatenates the value ofserver-id(say,server) and the default value ofserver-id-list([github]), producing ([github, server]); the action then produces two server entries, one forgithuband one forserver. - similarly, if the client specifies
server-id-listbut notserver-id, the action concatenates the default value ofserver-id(github) to the value ofserver-id-list(say,[server1, server2]), producing ([github, server1, server2]); the action then produces three server entries, one forgithub, one forserver1, and one forserver2.
A successful run of this PR is here:
https://github.com/drewctaylor/constrain/actions/runs/191542087/workflow
I would be interested in seeing this merged, or better yet a full fix for #85
Out of interest, is there any reason you chose to switch to server-id-list over the full fix of server-list?
@GavinF17 - I switched from server-list to server-id-list because it doesn't appear to be possible to receive values (such as server-list) as anything but strings. If it were possible to receive the value of server-list as, say, a JSON structure, I would have implemented the full fix.
@thboop @chrispat @tbroyer Can we think about merging this. We need this feature for our org and it would be very useful for many people.