mirror of
https://github.com/SonarSource/sonarqube-scan-action.git
synced 2025-12-13 01:41:15 +00:00
SQSCANGHA-94 Update version update logic (#188)
This commit is contained in:
parent
7d51dd28ef
commit
73bc64cb64
1 changed files with 30 additions and 12 deletions
42
.github/workflows/version_update.yml
vendored
42
.github/workflows/version_update.yml
vendored
|
|
@ -5,12 +5,12 @@ on:
|
||||||
- cron: '15 10 * * *'
|
- cron: '15 10 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-version:
|
check-version:
|
||||||
name: Prepare pull request for sonar-scanner version update
|
name: Check for sonar-scanner version update
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
outputs:
|
||||||
contents: write
|
should_update: ${{ steps.version-check.outputs.should_update }}
|
||||||
pull-requests: write
|
latest_version: ${{ steps.latest-version.outputs.latest }}
|
||||||
steps:
|
steps:
|
||||||
- run: sudo apt install -y jq
|
- run: sudo apt install -y jq
|
||||||
- run: sudo snap install yq
|
- run: sudo snap install yq
|
||||||
|
|
@ -25,25 +25,43 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cat sonar-scanner-version >> $GITHUB_OUTPUT
|
run: cat sonar-scanner-version >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: "Fetch lastest sonar-scanner version"
|
- name: "Fetch latest sonar-scanner version"
|
||||||
id: latest-version
|
id: latest-version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
./scripts/fetch_latest_version.sh > sonar-scanner-version
|
./scripts/fetch_latest_version.sh > sonar-scanner-version
|
||||||
cat sonar-scanner-version >> $GITHUB_OUTPUT
|
echo "latest=$(cat sonar-scanner-version)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: "Determine if update is needed"
|
||||||
|
id: version-check
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ "${{ steps.tagged-version.outputs.sonar-scanner-version }}" != "${{ steps.latest-version.outputs.latest }}" ]]; then
|
||||||
|
echo "should_update=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "should_update=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
update-version:
|
||||||
|
name: Prepare pull request for sonar-scanner version update
|
||||||
|
needs: check-version
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
if: needs.check-version.outputs.should_update == 'true'
|
||||||
|
steps:
|
||||||
- name: "Update default version"
|
- name: "Update default version"
|
||||||
if: steps.tagged-version.outputs.sonar-scanner-version != steps.latest-version.outputs.sonar-scanner-version
|
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
NEW_VERSION: ${{ steps.latest-version.outputs.sonar-scanner-version }}
|
NEW_VERSION: ${{ needs.check-version.outputs.latest-version }}
|
||||||
run: |
|
run: |
|
||||||
yq -i '.inputs.scannerVersion.default = strenv(NEW_VERSION)' action.yml
|
yq -i '.inputs.scannerVersion.default = strenv(NEW_VERSION)' action.yml
|
||||||
- name: "Create Pull Request for version update"
|
- name: "Create Pull Request for version update"
|
||||||
if: steps.tagged-version.outputs.sonar-scanner-version != steps.latest-version.outputs.sonar-scanner-version
|
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
UPDATE_BRANCH: update-to-sonar-scanner-${{ steps.latest-version.outputs.sonar-scanner-version }}
|
UPDATE_BRANCH: update-to-sonar-scanner-${{ needs.check-version.outputs.latest-version }}
|
||||||
TITLE: "Update SonarScanner CLI to ${{ steps.latest-version.outputs.sonar-scanner-version }}"
|
TITLE: "Update SonarScanner CLI to ${{ needs.check-version.outputs.latest-version }}"
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "SonarTech"
|
git config --global user.name "SonarTech"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue