Skip to content

Commit

Permalink
Adding release script, adds Make instructions
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph D. Marhee <jmarhee@interiorae.com>
  • Loading branch information
jmarhee committed Feb 11, 2021
1 parent 6abbbe1 commit cbdfb69
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@
tag-release:
if [[ $(TAG) == v?.?.? ]]; then echo "Tagging $(TAG)"; elif [[ $(TAG) == v?.?.?? ]]; then echo "Tagging $(TAG)"; else echo "Bad Tag Format: $(TAG)"; exit 1; fi && git tag -a $(TAG) -m "Releasing $(TAG)" ; read -p "Push tag: $(TAG)? " push_tag ; if [ "${push_tag}"="yes" ]; then git push origin $(TAG); fi

.SILENT:
create-release:
if [[ $(TAG) == v?.?.? ]]; then echo "Cutting release from $(TAG)"; elif [[ $(TAG) == v?.?.?? ]]; then echo "Cutting release from $(TAG)"; else echo "Bad Tag Format, cannot cut release: $(TAG)"; exit 1; fi && git tag -a $(TAG) -m "Releasing $(TAG)" ; read -p "Cut release from tag: $(TAG)? " push_tag ; if [ "${push_tag}"="yes" ]; then TAG=$(TAG) ./make-release.sh; fi

proxy-up:
terraform apply -auto-approve

proxy-down:
terraform destroy -auto-approve

proxy-status:
if [ "$(curl -s ipinfo.io/json | jq .ip)" = "$(terraform state show linode_instance.tunnel | grep ip_address | awk '{print $3}')" ]; then echo "Connected."; else echo "Tunnel not setup, or no Terraform state detected. (Check 'terraform state list' to see if Linode is created, or check IP at https://ipinfo.io/json)"; fi

proxy-test:
curl http://ipinfo.io/json

mac-proxy-down:
networksetup -setsocksfirewallproxystate wi-fi off
networksetup -setsocksfirewallproxystate wi-fi off

mac-proxy-reconnect:
# If you have not destroyed the proxy server, and wish to simply reconnect.
if [[ "$(terraform state show linode_instance.tunnel | grep ip_address | awk '{print $3}')" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then terraform apply -target=null_resource.set_osx_proxy -auto-approve; else echo "No Linode configured. Run 'make proxy-up' to connect."; fi
10 changes: 10 additions & 0 deletions make-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

TAG=$TAG
TAG_COMMIT=$(git rev-parse --short ${TAG})

AUTH_TOKEN=$GITHUB_TOKEN
curl \
-X POST "https://api.github.com/repos/jmarhee/terraform-linode-proxy/releases" -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
-d "{ \"body\": \"Cutting ${TAG} at ${TAG_COMMIT}\", \"draft\": false, \"name\": \"${TAG}\", \"prerelease\": false, \"tag_name\": \"${TAG}\" }"

0 comments on commit cbdfb69

Please sign in to comment.