-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feature): simplify contribution, fix github actions (#53)
- Loading branch information
Showing
10 changed files
with
152 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.3.7 | ||
4.3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,67 @@ | ||
import re | ||
import os | ||
import re | ||
|
||
|
||
def getVersion(): | ||
with open ('VERSION','r') as version: | ||
def get_version() -> str: | ||
with open("VERSION", "r") as version: | ||
for line in version: | ||
output=line | ||
bumpversion='v'+ output | ||
output = line | ||
bumpversion = "v" + output | ||
return bumpversion.rstrip() | ||
|
||
def getData(filename,expression,replacement): | ||
with open (filename, 'r') as readme: | ||
data=readme.read() | ||
data=re.sub(expression, replacement, data) | ||
|
||
def get_data(filename: str, expression: str, replacement: str) -> str: | ||
with open(filename, "r") as readme: | ||
data = readme.read() | ||
data = re.sub(expression, replacement, data) | ||
return data | ||
|
||
def updateREADME(): | ||
bumpversion = getVersion() | ||
data=getData('README.md',r'v\d+\.\d+\.\d+',bumpversion) | ||
with open ('README.md', 'w') as newfile: | ||
|
||
def update_readme() -> None: | ||
bumpversion = get_version() | ||
data = get_data("README.md", r"v\d+\.\d+\.\d+", bumpversion) | ||
with open("README.md", "w") as newfile: | ||
newfile.write(data) | ||
|
||
def updateCHANGELOG(): | ||
bumpversion = getVersion() | ||
data=getData('CHANGELOG.md',r'UNRELEASED',bumpversion) | ||
with open ('CHANGELOG.md', 'w') as newfile: | ||
|
||
def update_changelog() -> None: | ||
bumpversion = get_version() | ||
data = get_data("CHANGELOG.md", r"UNRELEASED", bumpversion) | ||
with open("CHANGELOG.md", "w") as newfile: | ||
newfile.write(data) | ||
|
||
def updateMaintf(): | ||
bumpversion = getVersion() | ||
replacement = "source = " + "\"git::https://github.com/jmgreg31/terraform-aws-cloudfront.git?ref={}\"".format(bumpversion) | ||
data=getData('example/main.tf',r'source[ \t]+\=.*',replacement) | ||
with open ('example/main.tf', 'w') as newfile: | ||
|
||
def update_example() -> None: | ||
bumpversion = get_version() | ||
replacement = ( | ||
"source = " | ||
+ '"git::https://github.com/jmgreg31/terraform-aws-cloudfront.git?ref={}"'.format( | ||
bumpversion | ||
) | ||
) | ||
data = get_data("example/main.tf", r"source[ \t]+\=.*", replacement) | ||
with open("example/main.tf", "w") as newfile: | ||
newfile.write(data) | ||
os.system('./terraform fmt example/') | ||
|
||
def updateGit(): | ||
bumpversion = getVersion() | ||
os.system('git config --global user.email \"jmgreg31@gmail.com\" && \ | ||
git config --global user.name "Jon Greg"') | ||
os.system('git checkout master') | ||
os.system('git add README.md CHANGELOG.md example/main.tf example/terraform.tfvars') | ||
os.system('git commit -m "Bump Version to {}"'.format(bumpversion)) | ||
os.system('git remote set-url origin https://jmgreg31:${GH_TOKEN}@github.com/jmgreg31/terraform-aws-cloudfront.git > /dev/null 2>&1') | ||
os.system('git push origin master') | ||
|
||
if __name__ == '__main__': | ||
updateREADME() | ||
updateCHANGELOG() | ||
updateMaintf() | ||
updateGit() | ||
os.system("./terraform fmt example/") | ||
|
||
|
||
def push_changes() -> None: | ||
bumpversion = get_version() | ||
os.system( | ||
'git config --global user.email "jmgreg31@gmail.com" && \ | ||
git config --global user.name "Jon Greg"' | ||
) | ||
os.system("git checkout master") | ||
os.system("git add README.md CHANGELOG.md example/main.tf example/terraform.tfvars") | ||
os.system('git commit -m "(ci): Bump Version to {}"'.format(bumpversion)) | ||
os.system( | ||
"git remote set-url origin https://jmgreg31:${GH_TOKEN}@github.com/jmgreg31/terraform-aws-cloudfront.git > /dev/null 2>&1" | ||
) | ||
os.system("git push origin master") | ||
|
||
|
||
if __name__ == "__main__": | ||
update_readme() | ||
update_changelog() | ||
update_example() | ||
push_changes() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,7 +206,7 @@ terraform { | |
} | ||
|
||
provider "aws" { | ||
version = ">= 3.0.0" | ||
version = ">= 3.41" | ||
region = var.region | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters