Adds github release creation

pull/667/head
sobolevn 3 years ago
parent 058c2cdba9
commit 6a9a86c502
No known key found for this signature in database
GPG Key ID: FF672D568AE3C73E

@ -1,41 +1,32 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
set -e
# Installing additional deps:
apk add --no-cache curl jq
# https://github.com/travis-ci/dpl/issues/155
# https://gist.github.com/Jaskaranbir/d5b065173b3a6f164e47a542472168c1
USER="$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f1)"
PROJECT="$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f2)"
LAST_RELEASE_TAG=$(curl "https://api.github.com/repos/${TRAVIS_REPO_SLUG}/releases/latest" 2>/dev/null | jq .name | sed 's/"//g')
LAST_RELEASE_TAG=$(curl \
--header "authorization: Bearer $GITHUB_TOKEN" \
--url "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest" \
2>/dev/null | jq .tag_name | sed 's/"//g'
)
echo "LAST_RELEASE_TAG=$LAST_RELEASE_TAG"
# An automatic changelog generator
gem install github_changelog_generator
NEW_CHANGELOG='CHANGELOG-RELEASE.md'
# move the manual log out of the way else it will be used by the tool.
rm CHANGELOG.md
# Generate CHANGELOG.md
# Generate new CHANGELOG.md with just the last changes
github_changelog_generator \
-u "$(cut -d "/" -f1 <<< "$TRAVIS_REPO_SLUG")" \
-p "$(cut -d "/" -f2 <<< "$TRAVIS_REPO_SLUG")" \
--user "$USER" \
--project "$PROJECT" \
--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"
--since-tag "$LAST_RELEASE_TAG" \
--token "$GITHUB_TOKEN" \
--output "$NEW_CHANGELOG"
echo 'Done! Changelog:'
cat "$NEW_CHANGELOG"

@ -7,10 +7,11 @@
# https://github.com/goreleaser/nfpm
FROM alpine:3.13
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
ENV CODE_DIR='/code'
ENV SECRETS_PROJECT_ROOT="$CODE_DIR"
# hadolint ignore=DL4006
RUN apk add --no-cache --update \
# fpm deps:
ruby \

@ -3,11 +3,11 @@ name: release
on:
push:
tags:
- v*
- 'v*'
workflow_dispatch:
jobs:
release:
release-packages:
environment:
name: artifactory
url: https://gitsecret.jfrog.io/artifactory
@ -23,3 +23,18 @@ jobs:
- uses: actions/checkout@v2
- name: Run checks
run: SECRETS_RELEASE_TYPE="${{ matrix.release-type }}" make release
github-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Generate changelog
run: make changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: softprops/action-gh-release@v1
with:
# Generated above by `make changelog`:
body_path: CHANGELOG-RELEASE.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored

@ -137,3 +137,4 @@ build/
docs/man
docs/_posts
docs/_includes/install-*.sh
CHANGELOG-RELEASE.md

@ -118,6 +118,20 @@ docs: build-docs
--rm jekyll/jekyll \
jekyll serve --safe --strict_front_matter
.PHONY: changelog
changelog:
@[ -z "${GITHUB_REPOSITORY}" ] \
&& echo 'GITHUB_REPOSITORY is unset' && exit 1 || true
docker pull githubchangeloggenerator/github-changelog-generator
docker run \
--volume="$${PWD}:/code" \
-w /code \
--entrypoint='' \
-e GITHUB_REPOSITORY \
-e GITHUB_TOKEN \
--rm githubchangeloggenerator/github-changelog-generator \
sh ".ci/github_release_script.sh"
#
# Packaging:
#

@ -16,7 +16,7 @@ gpg (GnuPG) 1.4.20
## Supported platforms
`git-secret` works with `Mac OS X` >= 10.9, `Ubuntu` >= 14.04, `Debian` >= 8.3, and `Fedora` / `CentOS`.
You can check the full list [here](https://github.com/sobolevn/git-secret/blob/issue-657/.github/workflows/test.yml).
You can check the full list [here](https://github.com/sobolevn/git-secret/blob/master/.github/workflows/test.yml).
You can add your platform to this list, if all the tests pass for you.
`Cygwin` support [is planned](https://github.com/sobolevn/git-secret/issues/40).

Loading…
Cancel
Save