Skip to content

Commit 62f9087

Browse files
[NO JIRA] Update releasability check (#4847)
1 parent 27ec244 commit 62f9087

1 file changed

Lines changed: 42 additions & 7 deletions

File tree

.github/workflows/releasability.yaml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,51 @@ name: Releasability status
22

33
on:
44
workflow_dispatch:
5+
# Inputs the workflow accepts.
6+
inputs:
7+
version:
8+
description: Optional; Used to specify the version to check, otherwise pulls the latest master version from artifactory.
9+
required: false
510

611
jobs:
7-
update_releasability_status:
12+
releasability-job:
13+
name: Releasability check
814
runs-on: ubuntu-latest
9-
name: Releasability status
1015
permissions:
11-
id-token: write
12-
contents: read
16+
id-token: write # required by SonarSource/vault-action-wrapper
17+
contents: read # required by checkout
1318
steps:
14-
- uses: SonarSource/gh-action_releasability@v2
15-
id: releasability-checks
19+
- name: Retrieve Vault Secrets
20+
id: secrets
21+
uses: SonarSource/vault-action-wrapper@v3
22+
with:
23+
secrets: |
24+
development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ARTIFACTORY_PASSWORD;
25+
development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader role | ARTIFACTORY_ROLE;
26+
development/kv/data/repox url | ARTIFACTORY_URL;
27+
28+
- name: Get the latest available version number
29+
id: latest-version
1630
env:
17-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
ARTIFACTORY_PRIVATE_USERNAME: vault-${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_ROLE }}
32+
ARTIFACTORY_PRIVATE_PASSWORD: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_PASSWORD }}
33+
ARTIFACTORY_URL: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_URL }}
34+
REPO: sonarsource-private-builds
35+
run: |
36+
if [[ -z "${{ github.event.inputs.version }}" ]]; then
37+
echo "version not provided, pulling latest version from $REPO."
38+
echo LATEST_VERSION=$(curl -s -u ${ARTIFACTORY_PRIVATE_USERNAME}:${ARTIFACTORY_PRIVATE_PASSWORD} \
39+
"${ARTIFACTORY_URL}/api/search/latestVersion?g=com.sonarsource.diffval&a=diff-app&repos=${REPO}") >> "$GITHUB_OUTPUT"
40+
else
41+
echo "version is provided, using its value: ${{ github.event.inputs.version }}."
42+
echo "LATEST_VERSION=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
43+
fi
44+
45+
- uses: SonarSource/gh-action_releasability@v2
46+
id: releasability
47+
with:
48+
branch: ${{ github.ref_name }}
49+
commit-sha: ${{ github.sha }}
50+
organization: ${{ github.repository_owner }}
51+
repository: ${{ github.event.repository.name }}
52+
version: ${{ steps.latest-version.outputs.LATEST_VERSION }}

0 commit comments

Comments
 (0)