Skip to content

Commit

Permalink
Merge pull request #208 from jedwards4b/add_version_file
Browse files Browse the repository at this point in the history
add version.txt and github workflow to update file.
  • Loading branch information
jedwards4b authored Dec 1, 2023
2 parents 0f884bf + 46b2eb9 commit 876b344
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
39 changes: 33 additions & 6 deletions .github/workflows/bumpversion.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
name: Bump version
name: Update file on PR merge
on:
push:
pull_request:
branches:
- main
types: closed

jobs:
build:
update_version:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: checkout
uses: actions/checkout@v3
with:
# Fetch full depth, otherwise the last step overwrites the last commit's parent, essentially removing the graph.
fetch-depth: 0

- name: GenerateTag
id: name_tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
create_annotated_tag: true
default_bump: patch
dry_run: true
tag_prefix: manic-
- name: Update version.txt
run: |
echo "${{ steps.name_tag.outputs.new_tag }}" > version.txt
- name: Amend the last commit
run: |
git config --global user.email "[email protected]"
git config --global user.name "OpenRCT2 git bot"
git commit -a --amend --no-edit
git push --force-with-lease
echo "Complete"name: Bump version
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v5.5
id: really_tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
create_annotated_tag: true
Expand Down
9 changes: 8 additions & 1 deletion checkout_externals
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from __future__ import print_function

import sys
import traceback

import os
import manic

if sys.hexversion < 0x02070000:
Expand All @@ -26,6 +26,13 @@ if sys.hexversion < 0x02070000:

if __name__ == '__main__':
ARGS = manic.checkout.commandline_arguments()
if ARGS.version:
version_info = ''
version_file_path = os.path.join(os.path.dirname(__file__),'version.txt')
with open(version_file_path) as f:
version_info = f.readlines()[0].strip()
print(version_info)
sys.exit(0)
try:
RET_STATUS, _ = manic.checkout.main(ARGS)
sys.exit(RET_STATUS)
Expand Down
3 changes: 3 additions & 0 deletions manic/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ def commandline_arguments(args=None):
'used up to two times, increasing the '
'verbosity level each time.')

parser.add_argument('--version', action='store_true', default=False,
help='Print manage_externals version and exit.')

parser.add_argument('--svn-ignore-ancestry', action='store_true', default=False,
help='By default, subversion will abort if a component is '
'already checked out and there is no common ancestry with '
Expand Down
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
manic-1.2.24-3-gba00e50

0 comments on commit 876b344

Please sign in to comment.