SIENTIAPDE-1243: Improve versioning logic in quality gate and optimize workflow
This commit refactors the version calculation logic in the quality gate workflow to handle initial releases and improve accuracy. It also adds disk space cleanup to the workflow and uses --no-cache-dir when installing dependencies to prevent caching issues.
This commit is contained in:
30
.github/workflows/quality-gate.yml
vendored
30
.github/workflows/quality-gate.yml
vendored
@@ -101,16 +101,20 @@ jobs:
|
|||||||
per_page: 1
|
per_page: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
let lastReleaseVersion = '0.0.0';
|
let lastReleaseVersion = null;
|
||||||
|
let newVersion = null;
|
||||||
|
|
||||||
if (releases.length > 0) {
|
if (releases.length > 0) {
|
||||||
lastReleaseVersion = releases[0].tag_name.replace(/^v/, '');
|
lastReleaseVersion = releases[0].tag_name.replace(/^v/, '');
|
||||||
console.log(`Latest release version: ${lastReleaseVersion}`);
|
console.log(`Latest release version: ${lastReleaseVersion}`);
|
||||||
|
// Calcular a nova versão baseada na última release
|
||||||
|
newVersion = calculateVersion(lastReleaseVersion, branchName);
|
||||||
} else {
|
} else {
|
||||||
console.log('No releases found, using 0.0.0 as baseline');
|
console.log('No releases found, starting from 0.0.0');
|
||||||
|
lastReleaseVersion = 'N/A';
|
||||||
|
// Primeira release: começar com 0.0.0 independente do tipo de branch
|
||||||
|
newVersion = '0.0.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calcular a nova versão baseada no branch
|
|
||||||
const newVersion = calculateVersion(lastReleaseVersion, branchName);
|
|
||||||
console.log(`Calculated version: ${newVersion}`);
|
console.log(`Calculated version: ${newVersion}`);
|
||||||
|
|
||||||
// Exportar a versão como output
|
// Exportar a versão como output
|
||||||
@@ -176,6 +180,18 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config --global url."https://oauth2:${GH_APP_TOKEN}@github.com/".insteadOf "https://github.com/"
|
git config --global url."https://oauth2:${GH_APP_TOKEN}@github.com/".insteadOf "https://github.com/"
|
||||||
|
|
||||||
|
- name: 🧹 Free Disk Space
|
||||||
|
run: |
|
||||||
|
echo "Disk space before cleanup:"
|
||||||
|
df -h
|
||||||
|
sudo rm -rf /usr/share/dotnet
|
||||||
|
sudo rm -rf /usr/local/lib/android
|
||||||
|
sudo rm -rf /opt/ghc
|
||||||
|
sudo rm -rf /opt/hostedtoolcache/CodeQL
|
||||||
|
sudo docker image prune --all --force
|
||||||
|
echo "Disk space after cleanup:"
|
||||||
|
df -h
|
||||||
|
|
||||||
- name: 🔧 Setup Python
|
- name: 🔧 Setup Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
@@ -192,8 +208,8 @@ jobs:
|
|||||||
- name: 📦 Install Dependencies
|
- name: 📦 Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r ${{ steps.prepare-requirements.outputs.PROCESSED_REQUIREMENTS_FILE }}
|
pip install --no-cache-dir -r ${{ steps.prepare-requirements.outputs.PROCESSED_REQUIREMENTS_FILE }}
|
||||||
pip install -r requirements-dev.txt
|
pip install --no-cache-dir -r requirements-dev.txt
|
||||||
|
|
||||||
- name: 📝 Code Formatting Check (Ruff)
|
- name: 📝 Code Formatting Check (Ruff)
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user