Skip to content

Merge to master #110

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

Merged
merged 27 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4907475
Check travis file
Jskobos Aug 23, 2019
8216e2c
Disable sudo
Jskobos Aug 23, 2019
a0fe41b
Merge pull request #98 from Jskobos/travis
Jskobos Aug 26, 2019
318fb11
Add deploy script
Jskobos Aug 26, 2019
6a2bcda
Check for arguments
Jskobos Aug 26, 2019
8d00fb6
Add checkout logic
Jskobos Aug 26, 2019
608ab57
Update the script to replace existing version numbers rather than DEV…
Jskobos Aug 26, 2019
efa4ef4
Update substitution in git checkout
Jskobos Aug 26, 2019
21ca31f
ensure deploy script is executable
stvnjacobs Aug 26, 2019
35d27c8
move deploy into bin directory
stvnjacobs Aug 26, 2019
10fc351
update shebang to be more forgiving
stvnjacobs Aug 26, 2019
f87f23d
add usage docs and remove else condition
stvnjacobs Aug 26, 2019
3e9322f
add prompt for users running locally
stvnjacobs Aug 26, 2019
3dcb1cb
ensure no local changes will be committed to development
stvnjacobs Aug 26, 2019
b5993c2
add some spacing for clarity
stvnjacobs Aug 26, 2019
d9fccb9
ensure provided version is valid semver
stvnjacobs Aug 26, 2019
dd3535e
update git add to be more selective
stvnjacobs Aug 26, 2019
b585a6a
add final checks for validity
stvnjacobs Aug 26, 2019
b9244fe
remove ci check since this will be run by a human
stvnjacobs Aug 26, 2019
0e46837
fix missing exit code for non-zero exits
stvnjacobs Aug 26, 2019
94e8432
update output to be more readable
stvnjacobs Aug 26, 2019
ec16003
fix version check
stvnjacobs Aug 26, 2019
bd7a6d0
Bump version to 0.1.0
stvnjacobs Aug 26, 2019
b77abfc
update sed to work on both bsd and gnu
stvnjacobs Aug 26, 2019
b784ec7
Revert "Bump version to 0.1.0"
stvnjacobs Aug 26, 2019
8171f3f
fix shellcheck warning
stvnjacobs Aug 27, 2019
dd95471
Merge pull request #107 from Jskobos/deploy-script
Jskobos Aug 27, 2019
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
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sudo: false
language: python
python:
- 3.7
script:
- python openapi-linter.py openapi.yaml
105 changes: 105 additions & 0 deletions bin/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/env bash

git_tag=""
version=""
version_regex="[0-9]+\.[0-9]+\.[0-9]"

help_text () {
echo
echo "Usage: deploy VERSION"
echo
}

# check for required version to deploy
if [ -z ${1+x} ]; then
help_text
echo "Error: VERSION is required"
exit 1
fi

if [[ "$1" =~ ^${version_regex}$ ]]; then
version="${1}"
git_tag="v${version}"
else
help_text
echo "Error: VERSION must be a valid semantic version (major.minor.patch)"
exit 1
fi

# let's get some permission before making changes
echo
echo "The following changes are about to be made:"
echo " - the development branch will be checked out"
echo " - a new release branch for ${version} will be created at release-${version}"
echo " - the version will be updated to ${version} in openapi.yaml"
echo " - these changes will be commited and tagged ${git_tag}"
echo
read -p "Do you want to continue? " -n 1 -r
echo

if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi

# if we have made it this far, we are ready to make changes
echo "Deploying version ${version}"

echo "Checking out development branch"
git checkout development

# ensure no local changes to openapi.yaml
git diff-index --quiet HEAD -- openapi.yaml

exit_status=$?
if [ $exit_status -ne 0 ]; then
echo
echo "Error: Local changes have been made to openapi.yaml."
echo " Please commit those changes before proceeding."
exit 1
fi

echo "Creating a release branch release-${version}"
git checkout -b "release-${version}"

echo "Updating openapi.yaml with the new version number"
sed -E -i.bak "s|version: ${version_regex}|version: ${version}|" openapi.yaml \
&& rm openapi.yaml.bak

echo "Committing the version bump"
git add openapi.yaml
git commit -m "Bump version to ${version}"

echo "Tagging the version commit with the version number"
git tag "${git_tag}"

echo "Running some final checks"
echo

exit_status=0

if grep -Fxq " version: ${version}" openapi.yaml; then
echo "OK - version ${version} is present in openapi.yaml"
else
echo "ERROR - version ${version} is not present in openapi.yaml"
exit_status=1
fi

if git tag | grep -Fxq "${git_tag}"; then
echo "OK - ${git_tag} is present in git tags"
else
echo "ERROR - ${git_tag} is not present in git tags"
exit_status=1
fi

if [ $exit_status -ne 0 ]; then
echo
echo "Please resolve the ERRORs above."
exit 1
else
echo
echo "Release process is complete."
echo
echo "Once confirmed changes are verified, you can:"
echo " git push release-${version}"
echo " git push ${git_tag}"
fi
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
openapi: 3.0.1
info:
version: DEVELOPMENT
version: 4.3.1
title: Linode API
x-logo: {
url: '/api/v4/linode-logo.svg',
Expand Down