Skip to content

Commit

Permalink
Update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sscottgvit committed May 8, 2024
1 parent db2ff81 commit 79b2180
Showing 1 changed file with 10 additions and 43 deletions.
53 changes: 10 additions & 43 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down

0 comments on commit 79b2180

Please sign in to comment.