Automate the GitHub release (#411)

pull/422/head^2
Simon Massey 5 years ago committed by GitHub
parent 70fd1bcd80
commit 6a93549179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,41 @@
#!/bin/bash
# https://github.com/travis-ci/dpl/issues/155
# https://gist.github.com/Jaskaranbir/d5b065173b3a6f164e47a542472168c1
LAST_RELEASE_TAG=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/latest 2>/dev/null | jq .name | sed 's/"//g')
echo "LAST_RELEASE_TAG=$LAST_RELEASE_TAG"
# An automatic changelog generator
gem install github_changelog_generator
# move the manual log out of the way else it will be used by the tool.
rm CHANGELOG.md
# Generate CHANGELOG.md
github_changelog_generator \
-u $(cut -d "/" -f1 <<< $TRAVIS_REPO_SLUG) \
-p $(cut -d "/" -f2 <<< $TRAVIS_REPO_SLUG) \
--token $GITHUB_OAUTH_TOKEN \
--since-tag ${LAST_RELEASE_TAG}
body="$(cat CHANGELOG.md)"
# GitHub API needs json data. here we use the mighty jq from https://stedolan.github.io/jq/
jq -n \
--arg body "$body" \
--arg name "$TRAVIS_TAG" \
--arg tag_name "$TRAVIS_TAG" \
--arg target_commitish "$GIT_BRANCH" \
'{
body: $body,
name: $name,
tag_name: $tag_name,
target_commitish: $target_commitish,
draft: true,
prerelease: false
}' > CHANGELOG.md
echo "Create release $TRAVIS_TAG for repo: $TRAVIS_REPO_SLUG, branch: $GIT_BRANCH"
curl -H "Authorization: token $GITHUB_OAUTH_TOKEN" --data @CHANGELOG.md "https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases"

@ -104,7 +104,7 @@ script:
- chmod +x ".ci/script.sh" && ".ci/script.sh"
before_deploy:
- chmod +x ".ci/before_deploy.sh" && ".ci/before_deploy.sh"
- chmod +x ".ci/before_deploy.sh" && ".ci/before_deploy.sh" && chmod +x ".ci/github_release_script.sh"
deploy:
- provider: bintray
@ -127,6 +127,12 @@ deploy:
user: "sobolevn"
key: "$BINTRAY_API_KEY"
passphrase: "$BINTRAY_GPG_PASS"
- provider: script
script: bash .ci/github_release_script.sh
on:
all_branches: true
tag: true
condition: "$TRAVIS_TAG =~ ^v.*$ && $GITSECRET_DIST == rpm"
after_deploy:
- chmod +x ".ci/after_deploy.sh" && ".ci/after_deploy.sh"

@ -24,6 +24,7 @@
- Fix re: SECRETS_DIR in 'init' and SECRETS_EXTENSION in test_reveal.bats (#364)
- Use SECRETS_GPG_COMMAND env var in gpg version check (#389)
- Add header to git-secret.7 man page, for debian and doc improvement (#386)
- Automate the GitHub release (#411)
## Misc

Loading…
Cancel
Save