diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index ab213e8..8720909 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -241,8 +241,12 @@ jobs: - name: Checkout uses: actions/checkout@v3 + + - uses: actions-ecosystem/action-get-latest-tag@v1 + id: latest-tag with: - fetch-depth: 0 + semver_only: true + initial_version: 0.0.1 - name: Prepare .changes file # The .changes file is updated only in release creation. This current task should be improved @@ -252,18 +256,16 @@ jobs: CHANGES_FILE=$PACKAGE_NAME.changes osc checkout $OBS_PROJECT $PACKAGE_NAME $CHANGES_FILE mv $CHANGES_FILE $FOLDER - VERSION=$(./hack/get_version_from_git.sh) - TAG=$(echo $VERSION | cut -f1 -d+) - hack/gh_release_to_obs_changeset.py $REPOSITORY -a shap-staff@suse.de -t $TAG -f $FOLDER/$CHANGES_FILE + VERSION=${{ steps.latest-tag.outputs.tag }} + hack/gh_release_to_obs_changeset.py $REPOSITORY -a shap-staff@suse.de -t $VERSION -f $FOLDER/$CHANGES_FILE - name: Set version run: | - VERSION=$(./hack/get_version_from_git.sh) - TAG=$(echo $VERSION | cut -f1 -d+) + VERSION=${{ steps.latest-tag.outputs.tag }} sed -i 's~%%REVISION%%~${{ github.sha }}~' $FOLDER/_service && \ sed -i 's~%%REPOSITORY%%~${{ github.repository }}~' $FOLDER/_service && \ - sed -i 's~%%VERSION%%~'"${TAG}"'~' $FOLDER/_service && \ - sed -i 's~%%VERSION%%~'"${TAG}"'~' $FOLDER/Dockerfile + sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/_service && \ + sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/Dockerfile - name: Configure OSC # OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home