Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SONARXML-214 Use v2 of the releasability gh action #323

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 44 additions & 6 deletions .github/workflows/releasability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,53 @@ 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:
update_releasability_status:
releasability-job:
name: Releasability check
runs-on: ubuntu-latest
name: Releasability status
permissions:
id-token: write
contents: read
id-token: write # required by SonarSource/vault-action-wrapper
contents: read # required by checkout
steps:
- uses: SonarSource/gh-action_releasability/releasability-status@23c9ad31b2d613bade88da898dfdca0b5c65ac69 # v1.2.1
- 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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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.xml
ARTIFACT_ID: sonar-xml-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 }}
Loading