Skip to content

Commit 24d01ab

Browse files
Use v2 of the releasability gh action
1 parent 67cf066 commit 24d01ab

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

.github/workflows/releasability.yaml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,53 @@ 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/releasability-status@23c9ad31b2d613bade88da898dfdca0b5c65ac69 # v1.2.1
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
1530
env:
16-
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-public-builds
35+
GROUP_ID: org.sonarsource.xml
36+
ARTIFACT_ID: sonar-xml-plugin
37+
run: |
38+
if [[ -z "${{ github.event.inputs.version }}" ]]; then
39+
echo "version not provided, pulling latest version from $REPO."
40+
echo LATEST_VERSION=$(curl -s -u ${ARTIFACTORY_PRIVATE_USERNAME}:${ARTIFACTORY_PRIVATE_PASSWORD} \
41+
"${ARTIFACTORY_URL}/api/search/latestVersion?g=${GROUP_ID}&a=${ARTIFACT_ID}&repos=${REPO}") >> "$GITHUB_OUTPUT"
42+
else
43+
echo "version is provided, using its value: ${{ github.event.inputs.version }}."
44+
echo "LATEST_VERSION=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
45+
fi
46+
47+
- uses: SonarSource/gh-action_releasability@v2
48+
id: releasability
49+
with:
50+
branch: ${{ github.ref_name }}
51+
commit-sha: ${{ github.sha }}
52+
organization: ${{ github.repository_owner }}
53+
repository: ${{ github.event.repository.name }}
54+
version: ${{ steps.latest-version.outputs.LATEST_VERSION }}

0 commit comments

Comments
 (0)