From 8115f0c9b6b546e8d04dd7c269e7f1309220b82a Mon Sep 17 00:00:00 2001 From: frozenIceage Date: Thu, 18 Jul 2024 15:59:16 +0200 Subject: [PATCH] Update release.yml --- .github/workflows/release.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd771a8..4f1daa5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,13 @@ jobs: PROJECT: home:ChHuang PACKAGE: python-osc-tiny steps: + - uses: actions/checkout@master + - name: Get latest release tag + id: get_latest_release + run: | + LATEST_TAG=$(git describe --tags --abbrev=0) + LATEST_TAG=${LATEST_TAG#v} + echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV - name: Install osc run: | sudo apt-get update -y @@ -26,8 +33,6 @@ jobs: user = ${{ secrets.OSC_USER }} pass = ${{ secrets.OSC_PASS }} EOF - - name: Print file content - run: cat $HOME/.oscrc - name: checkout package run: | osc branchco $PROJECT $PACKAGE @@ -37,10 +42,8 @@ jobs: - name: Fetch tarball from PyPI id: fetch-tarball run: | - VERSION=${{ github.event.release.tag_name }} - FILE_NAME=osc-tiny-$VERSION.tar.gz - FILE_URL="https://files.pythonhosted.org/packages/source/o/osc-tiny/osc_tiny-$VERSION.tar.gz -O $FILE_NAME" - echo "::set-output name=version::$VERSION" + FILE_NAME=osc-tiny-$LATEST_TAG.tar.gz + FILE_URL="https://files.pythonhosted.org/packages/source/o/osc-tiny/osc_tiny-$LATEST_TAG.tar.gz -O $FILE_NAME" while [ ! -f "$FILE_NAME" ]; do echo "File not found. Downloading..." @@ -54,13 +57,13 @@ jobs: - name: Update version in spec file run: | - sed -i "s/^Version:.*/Version: ${{ steps.fetch-tarball.outputs.version }}/" *.spec + sed -i "s/^Version:.*/Version: $LATEST_TAG/" *.spec - name: Commit and push changes run: | - osc vc -m 'Update to version ${{ steps.fetch-tarball.outputs.version }}' - osc commit -m "Update to version ${{ steps.fetch-tarball.outputs.version }}" + osc vc -m 'Update to version $LATEST_TAG' + osc commit -m "Update to version $LATEST_TAG" - name: Submit changes to OBS run: | - osc submitrequest -m "Update package to version ${{ steps.fetch-tarball.outputs.version }}" + osc submitrequest -m "Update package to version $LATEST_TAG"