Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Auto Github release creation #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

/doxygen_docs
/doxygen.tag
auth-token
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ compiler:
before_install:
- sudo apt-add-repository ppa:smspillaz/cmake-2.8.12 -y
- sudo apt-get update -qq
- openssl aes-256-cbc -K $encrypted_f4b786671656_key -iv $encrypted_f4b786671656_iv -in auth-token.enc -out auth-token -d

install:
- sudo apt-get install -qq texlive
Expand All @@ -21,3 +22,10 @@ script:
- make
- make tests
- make docs

deploy:
# Deploys to Doxyparse official GitHub
provider: script
script: sh scripts/create-gh-release.sh
on:
branch: master
27 changes: 27 additions & 0 deletions scripts/sh/create-gh-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

VERSION=$(cat ../../VERSION)
REPO_FULL_NAME=$(git config --get remote.origin.url | sed 's/.*:\/\/github.com\///;s/.git$//')
TEXT="Deploying version $VERSION of $REPO_FULL_NAME"
TOKEN_SHA=$(cat ../../auth-token)
REPO_URL=https://api.github.com/repos/$REPO_FULL_NAME/releases?access_token=$TOKEN_SHA
BRANCH=$(git rev-parse --abbrev-ref HEAD)

# Sample JSON pattern accepted by GitHub API
generate_post_data()
{
cat <<EOF
{
"tag_name": "$VERSION",
"target_commitish": "$BRANCH",
"name": "$VERSION",
"body": "$TEXT",
"draft": false,
"prerelease": false
}
EOF
}

# Posting Sample JSON to GitHub API using required token and credentials
echo "Creating Release v$VERSION for $REPO_FULL_NAME"
curl --data "$(generate_post_data)" $REPO_URL