mirror of
https://github.com/actions/setup-java.git
synced 2024-11-23 18:19:03 +00:00
7c88894700
* Implement support for custom vendors in setup-java * minor improvements * minor refactoring * Add unit tests and e2e tests * Update documentation for setup-java@v2 release * minor improvements * regenerate dist * fix comments * resolve comments * resolve comments * fix tests * Update README.md Co-authored-by: George Adams <george.adams@microsoft.com> * Apply suggestions from code review Co-authored-by: Konrad Pabjan <konradpabjan@github.com> * fix minor nitpicks * handle 4th digit * pull latest main * Update README.md * rename adoptium to adopt * rename adoptium to adopt * rename adoptium to adopt * Update README.md * make java-version and distribution required for action * update readme * fix tests * fix e2e tests Co-authored-by: George Adams <george.adams@microsoft.com> Co-authored-by: Konrad Pabjan <konradpabjan@github.com>
83 lines
2.4 KiB
YAML
83 lines
2.4 KiB
YAML
name: Validate publishing functionality
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- releases/*
|
|
- v2-preview
|
|
paths-ignore:
|
|
- '**.md'
|
|
pull_request:
|
|
paths-ignore:
|
|
- '**.md'
|
|
|
|
jobs:
|
|
setup-java-publishing:
|
|
name: Validate settings.xml
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: setup-java
|
|
uses: ./
|
|
id: setup-java
|
|
with:
|
|
distribution: 'adopt'
|
|
java-version: '11'
|
|
server-id: maven
|
|
server-username: MAVEN_USERNAME
|
|
server-password: MAVEN_CENTRAL_TOKEN
|
|
gpg-passphrase: MAVEN_GPG_PASSPHRASE
|
|
- name: Validate settings.xml
|
|
run: |
|
|
$homePath = $env:USERPROFILE
|
|
if (-not $homePath) {
|
|
$homePath = $env:HOME
|
|
}
|
|
$xmlPath = Join-Path $homePath ".m2" "settings.xml"
|
|
|
|
Get-Content $xmlPath | ForEach-Object { Write-Host $_ }
|
|
|
|
[xml]$xml = Get-Content $xmlPath
|
|
$servers = $xml.settings.servers.server
|
|
if (($servers[0].id -ne 'maven') -or ($servers[0].username -ne '${env.MAVEN_USERNAME}') -or ($servers[0].password -ne '${env.MAVEN_CENTRAL_TOKEN}')) {
|
|
throw "Generated XML file is incorrect"
|
|
}
|
|
|
|
if (($servers[1].id -ne 'gpg.passphrase') -or ($servers[1].passphrase -ne '${env.MAVEN_GPG_PASSPHRASE}')) {
|
|
throw "Generated XML file is incorrect"
|
|
}
|
|
shell: pwsh
|
|
|
|
test-publishing-custom-location:
|
|
name: Validate settings.xml in custom location
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: setup-java
|
|
uses: ./
|
|
id: setup-java
|
|
with:
|
|
distribution: 'adopt'
|
|
java-version: '11'
|
|
server-id: maven
|
|
server-username: MAVEN_USERNAME
|
|
server-password: MAVEN_CENTRAL_TOKEN
|
|
gpg-passphrase: MAVEN_GPG_PASSPHRASE
|
|
settings-path: ${{ runner.temp }}
|
|
- name: Validate settings.xml location
|
|
run: |
|
|
$path = Join-Path $env:RUNNER_TEMP "settings.xml"
|
|
if (-not (Test-Path $path)) {
|
|
throw "settings.xml file is not found in expected location"
|
|
}
|
|
shell: pwsh |