forked from MartinHeinz/go-github-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6fb642c
commit 7aafae2
Showing
3 changed files
with
42 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
github_webhook_secret: "verysecret" | ||
github_webhook_secret: "WEBHOOK_SECRET" |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
for ARGUMENT in "$@" | ||
do | ||
|
||
KEY=$(echo $ARGUMENT | cut -f1 -d=) | ||
VALUE=$(echo $ARGUMENT | cut -f2 -d=) | ||
|
||
case "$KEY" in | ||
APP_ID) APP_ID=${VALUE} ;; | ||
INSTALLATION_ID) INSTALLATION_ID=${VALUE} ;; | ||
WEBHOOK_SECRET) WEBHOOK_SECRET=${VALUE} ;; | ||
REGISTRY) REGISTRY=${VALUE} ;; | ||
*) | ||
esac | ||
done | ||
|
||
DUMMY_REGISTRY='ghcr.io/martinheinz/go-github-app' | ||
BLUE='\033[0;34m' | ||
NC='\033[0m' # No Color | ||
|
||
echo -e "\n${BLUE}Renaming variables and files...${NC}\n" | ||
|
||
sed -i s~APP_ID~$APP_ID~g cmd/app/utils/utils.go | ||
sed -i s~INSTALLATION_ID~$INSTALLATION_ID~g cmd/app/utils/utils.go | ||
sed -i s~WEBHOOK_SECRET~$WEBHOOK_SECRET~g config/server.yaml | ||
sed -i s~$DUMMY_REGISTRY~$REGISTRY~g Makefile | ||
|
||
cat $KEY_PATH > config/github-app.pem | ||
|
||
echo -e "\n${BLUE}Installing dependencies...${NC}\n" | ||
go mod vendor | ||
|
||
echo -e "\n${BLUE}Testing if everything works...${NC}\n" | ||
|
||
echo -e "\n${BLUE}Test: make test${NC}\n" | ||
make test | ||
echo -e "\n${BLUE}Test: make build${NC}\n" | ||
make build | ||
|
||
# Usage: | ||
# ./configure_project.sh APP_ID="12345" INSTALLATION_ID="12345678" WEBHOOK_SECRET="verysecret" KEY_PATH="./github_key.pem" REGISTRY="ghcr.io/<GITHUB_USERNAME>/go-github-app" |