-
Notifications
You must be signed in to change notification settings - Fork 688
54 lines (50 loc) · 2.35 KB
/
releasability.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Releasability status
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
description: Optional; Used to specify the version to check, otherwise pulls the latest master version from artifactory.
required: false
jobs:
releasability-job:
name: Releasability check
runs-on: ubuntu-latest
permissions:
id-token: write # required by SonarSource/vault-action-wrapper
contents: read # required by checkout
steps:
- name: Retrieve Vault Secrets
id: secrets
uses: SonarSource/vault-action-wrapper@v3
with:
secrets: |
development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ARTIFACTORY_PASSWORD;
development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader role | ARTIFACTORY_ROLE;
development/kv/data/repox url | ARTIFACTORY_URL;
- name: Get the latest available version number
id: latest-version
env:
ARTIFACTORY_PRIVATE_USERNAME: vault-${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_ROLE }}
ARTIFACTORY_PRIVATE_PASSWORD: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_PASSWORD }}
ARTIFACTORY_URL: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_URL }}
REPO: sonarsource-public-builds
GROUP_ID: org.sonarsource.java
ARTIFACT_ID: sonar-java-plugin
run: |
if [[ -z "${{ github.event.inputs.version }}" ]]; then
echo "version not provided, pulling latest version from $REPO."
echo LATEST_VERSION=$(curl -s -u ${ARTIFACTORY_PRIVATE_USERNAME}:${ARTIFACTORY_PRIVATE_PASSWORD} \
"${ARTIFACTORY_URL}/api/search/latestVersion?g=${GROUP_ID}&a=${ARTIFACT_ID}&repos=${REPO}") >> "$GITHUB_OUTPUT"
else
echo "version is provided, using its value: ${{ github.event.inputs.version }}."
echo "LATEST_VERSION=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
fi
- uses: SonarSource/gh-action_releasability@v2
id: releasability
with:
branch: ${{ github.ref_name }}
commit-sha: ${{ github.sha }}
organization: ${{ github.repository_owner }}
repository: ${{ github.event.repository.name }}
version: ${{ steps.latest-version.outputs.LATEST_VERSION }}