Skip to content

Commit

Permalink
fixv4
Browse files Browse the repository at this point in the history
  • Loading branch information
thommythomaso committed Feb 26, 2024
1 parent 115688b commit c3a052f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ jobs:
git config user.name "github-ci"
git fetch --all
python3 util/deploy.py
git merge --squash origin/dev-tbenz
File renamed without changes.
21 changes: 17 additions & 4 deletions util/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""Deploy script run by ci. Creates a deploy branch which includes generated files."""
import os
import time
import sys

# Git command fragments
CHECK_BRANCH_CMD = 'git rev-parse --verify'
Expand All @@ -32,17 +33,23 @@

# get current branch info
current_branch = os.popen(GET_BRANCH_CMD).read().split('\n')[0]
print(f'Current branch: {current_branch}')
current_hash = os.popen(GET_COMMIT_ID_CMD).read().split('\n')[0]
print(f'Current hash: {current_hash}')
current_msg = '\n'.join(os.popen(GET_COMMIT_MSG_CMD).read().split('\n')[:-1])
print(f'Current commit message: \n{current_msg}')

# create target branch
deploy_branch = f'__deploy__{current_branch}'
print(f'Deploy branch: {deploy_branch}\n\n')
last_deploy_hash = os.popen(f'{CHECK_BRANCH_CMD} {deploy_branch}').read()
print(f'Last deploy hash: {last_deploy_hash} (empty if on deploy branch present)')
deploy_msg = f'{current_msg}\n-----\n\nDeployed from {current_hash}'
print(f'Deploy commit message:\n{deploy_msg}')

# checkout current working branch
os.popen(f'{GIT_CHECKOUT_CMD} {current_branch}')
time.sleep(0.5)
## checkout current working branch
#os.popen(f'{GIT_CHECKOUT_CMD} {current_branch}')
#time.sleep(0.5)

# spawn or switch to deploy branch
if last_deploy_hash == '':
Expand All @@ -51,12 +58,18 @@
else:
# deploy branch exists
os.popen(f'{GIT_CHECKOUT_CMD} {deploy_branch}')
time.sleep(0.5)
time.sleep(2)

# merge feature into deploy branch
print('\n.\n.\n.\n.\n.\n.\n.\n')
os.popen(f'{GIT_MERGE_SQUASH_CMD} {ORIGIN}/{current_branch}')
time.sleep(0.5)

print('\n.\n.\n.\n.\n.\n.\n.\n')
print(os.popen('git status').read())

sys.exit(0)

# selectively deactivate gitignore to check in generated files
with open('target/rtl/.gitignore', 'r', encoding='utf-8') as f:
content = f.read().split('\n')[:-1]
Expand Down

0 comments on commit c3a052f

Please sign in to comment.