Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

another method of bumping pre release version #49

Merged
merged 1 commit into from
Nov 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 31 additions & 34 deletions .github/workflows/afids-validator_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,46 +129,43 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check if pre-release
- name: Check pre-release
id: prerelease-version
env:
NEXT_VERSION: ${{ steps.release-drafter.outputs.name }}
run: |
current_version=`grep 'version=*' setup.py | sed 's/version=//' | tr -d '",'`
if [[ "$current_version" == *"-pre"* ]]; then
current_bump=${current_version##*pre}
next_bump=$(( current_bump + 1 ))
next_version=${NEXT_VERSION}-pre${next_bump}
echo '::set-output name=next_version::$(next_version)"'
echo next_bump=`expr $current_bump + 1`
echo '::set-output name=next_version::${{ steps.release-drafter.outputs.name }}-pre${next_bump}"'
else
next_version=${NEXT_VERSION}-pre1
echo '::set-output name=next_version::$(next_version)"'
echo '::set-output name=next_version::${{ steps.release-drafter.outputs.name }}-pre1"'
fi

- name: Update setup.py version
uses: jacobtomlinson/gha-find-replace@master
with:
include: "setup.py"
find: "v(?:([0-9]+.[0-9]+.[0-9]+.+)|([0-9]+.[0-9]+.[0-9]+))"
replace: "${{ steps.prerelease-version.outputs.next_version }}"

- name: Commit updates
id: git-commit
env:
LATEST_VERSION: ${{ steps.prerelease-version.outputs.next_version }}
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git diff-index --quiet HEAD || git commit -m "Bump version to $LATEST_VERSION" -a

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy test heroku app
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: afids-validator-test
heroku_email: ${{ secrets.HEROKU_EMAIL }}
# - name: Update setup.py version
# uses: jacobtomlinson/gha-find-replace@master
# with:
# include: "setup.py"
# find: "v(?:([0-9]+.[0-9]+.[0-9]+.+)|([0-9]+.[0-9]+.[0-9]+))"
# replace: "${{ steps.prerelease-version.outputs.next_version }}"

# - name: Commit updates
# id: git-commit
# env:
# LATEST_VERSION: ${{ steps.prerelease-version.outputs.next_version }}
# run: |
# git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
# git config --local user.name "github-actions[bot]"
# git diff-index --quiet HEAD || git commit -m "Bump version to $LATEST_VERSION" -a

# - name: Push changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}

# - name: Deploy test heroku app
# uses: akhileshns/[email protected]
# with:
# heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
# heroku_app_name: afids-validator-test
# heroku_email: ${{ secrets.HEROKU_EMAIL }}