|
| 1 | +trigger: |
| 2 | + none |
| 3 | + |
| 4 | +pool: |
| 5 | + vmImage: ubuntu-22.04 |
| 6 | + |
| 7 | +steps: |
| 8 | +- bash: | |
| 9 | + echo "Can only publish from a release branch. Unexpected branch name: $CURRENT_BRANCH" |
| 10 | + exit 1 |
| 11 | + env: |
| 12 | + CURRENT_BRANCH: ${{ variables['Build.SourceBranchName'] }} |
| 13 | + condition: ${{ not(startsWith(variables['Build.SourceBranchName'], 'release-')) }} |
| 14 | + displayName: "Check the branch is a release branch" |
| 15 | + |
| 16 | +- bash: | |
| 17 | + echo "importing GPG key:" |
| 18 | + # Pipeline variables do not preserve line ends so we use base64 instead of --armored as a workaround. |
| 19 | + echo $GPG_PRIVATE_KEY_BASE64 | base64 -d | gpg --batch --import |
| 20 | + echo "list keys after import:" |
| 21 | + gpg --list-keys |
| 22 | + env: |
| 23 | + GPG_PRIVATE_KEY_BASE64: $(GPG_PRIVATE_KEY_BASE64) # secret variable has to be mapped to an env variable |
| 24 | + displayName: "Import gpg key" |
| 25 | + |
| 26 | +- bash: ./scripts/download_driver_for_all_platforms.sh |
| 27 | + displayName: 'Download driver' |
| 28 | + |
| 29 | +- bash: mvn -B deploy -D skipTests --no-transfer-progress --activate-profiles release -D gpg.passphrase=$GPG_PASSPHRASE -DaltDeploymentRepository=snapshot-repo::default::file:$(pwd)/local-build |
| 30 | + displayName: 'Build and deploy to a local directory' |
| 31 | + env: |
| 32 | + GPG_PASSPHRASE: $(GPG_PASSPHRASE) # secret variable has to be mapped to an env variable |
| 33 | + |
| 34 | +- bash: | |
| 35 | + for file in $(find snapshots -type f); do |
| 36 | + echo "processing: $file" |
| 37 | + if [[ $file =~ \.(md5|sha1|sha256)$ ]]; then |
| 38 | + continue |
| 39 | + fi |
| 40 | + sha256sum "$file" | cut -f1 -d \ > "$file.sha256" |
| 41 | + done |
| 42 | + displayName: 'Create .sha256 files' |
| 43 | + |
| 44 | +- task: EsrpRelease@2 |
| 45 | + inputs: |
| 46 | + ConnectedServiceName: 'Playwright-Java-ESRP' |
| 47 | + Intent: 'PackageDistribution' |
| 48 | + ContentType: 'Maven' |
| 49 | + PackageLocation: './local-build' |
| 50 | + |
| 51 | + |
| 52 | + ServiceEndpointUrl: 'https://api.esrp.microsoft.com' |
| 53 | + MainPublisher: 'PlaywrightJava' |
| 54 | + DomainTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47' |
| 55 | + displayName: 'ESRP Release to Maven' |
0 commit comments