From 79b218049208019220b4838c412d5dde9a1c6cfe Mon Sep 17 00:00:00 2001 From: sscottgvit Date: Wed, 8 May 2024 13:11:51 -0500 Subject: [PATCH] Update workflow --- .github/workflows/master.yml | 53 +++++++----------------------------- 1 file changed, 10 insertions(+), 43 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 928e6a4..4863d29 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -11,47 +11,6 @@ jobs: outputs: new_version: ${{ steps.version.outputs.new_version }} - steps: - - uses: actions/checkout@v3 - - - name: Extract and increment version using sed and awk - id: increment_version - run: | - version=$(sed -n "s/^ *version=['\"]\([^'\"]*\)['\"],/\1/p" setup.py) - new_version=$(echo $version | awk -F. -v OFS=. '{$NF += 1; print}') - sed -i "s;$version;$new_version;g" setup.py - echo "new_version=$new_version" >> $GITHUB_ENV - - - name: Get last commit details - id: last_commit - run: | - commit_message=$(git log -1 --pretty=%B) - commit_author=$(git log -1 --pretty=%an) - echo "commit_message=$commit_message" >> $GITHUB_ENV - echo "commit_author=$commit_author" >> $GITHUB_ENV - - - name: Update ChangeLog - run: | - echo "## v${{ env.new_version }} - $(date +'%Y-%m-%d')" >> ChangeLog.md - echo "- Last commit by ${{ env.commit_author }}: ${{ env.commit_message }}" >> ChangeLog.md - - - name: Commit and push changes - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add setup.py ChangeLog.md - git commit -m "Bump version to ${{ env.new_version }} and update ChangeLog" - git push - - update: - needs: prepare - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: [3.11] - os: [ubuntu-latest] - steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -74,16 +33,24 @@ jobs: echo "## v${{ env.new_version }} - $(date +'%Y-%m-%d')" >> ChangeLog.md echo "- Last commit by ${{ env.commit_author }}: Updated exploit database mappings" >> ChangeLog.md + - name: Extract and increment version using sed and awk + id: increment_version + run: | + version=$(sed -n "s/^ *version=['\"]\([^'\"]*\)['\"],/\1/p" setup.py) + new_version=$(echo $version | awk -F. -v OFS=. '{$NF += 1; print}') + sed -i "s;$version;$new_version;g" setup.py + echo "new_version=$new_version" >> $GITHUB_ENV + - name: Commit and push changes run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add -A - git commit -m "Update exploit database mappings" + git commit -m "Update exploit database mapping, Bump version to ${{ env.new_version }} and update ChangeLogs" git push build: - needs: update + needs: prepare runs-on: ${{ matrix.os }} strategy: fail-fast: false