diff --git a/.circleci/config.yml b/.circleci/config.yml index 64f8a99..41f7582 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ orbs: orb-tools: circleci/orb-tools@9.1.0 workflows: - validate-publish-dev: + validate-dev: jobs: - orb-tools/lint - orb-tools/publish-dev: @@ -13,15 +13,21 @@ workflows: checkout: true requires: - orb-tools/lint - tag-triggered-publish: + draft-release: jobs: - hold-for-approval: filters: branches: - ignore: /.*/ - tags: - only: /^\d+\.\d+\.\d+$/ + only: /release\/.*/ type: approval + - github-release: + filters: + branches: + only: /release\/.*/ + requires: + - hold-for-approval + publish: + jobs: - orb-tools/publish: orb-ref: buildpacks/pack@$CIRCLE_TAG orb-path: orb.yml @@ -31,6 +37,33 @@ workflows: ignore: /.*/ tags: only: /^\d+\.\d+\.\d+$/ - requires: - - hold-for-approval +jobs: + github-release: + machine: + image: ubuntu-2004:202010-01 + steps: + - run: + name: Install generator + command: gem install github_changelog_generator + - run: + name: Install releaser + command: go get -u github.com/tcnksm/ghr + - checkout + - run: + name: Determine version + command: | + [[ $CIRCLE_BRANCH =~ ^release/(.*)$ ]] && echo -n ${BASH_REMATCH[1]} > VERSION || (echo "failed to determine version" && exit 99) + cat VERSION + - run: + name: Generate changelog + command: | + github_changelog_generator --user $CIRCLE_PROJECT_USERNAME --project $CIRCLE_PROJECT_REPONAME --token $GITHUB_BOT_PAT --future-release $(cat VERSION) -o CHANGELOG.tmp.md + # remove footer + head -n -3 CHANGELOG.tmp.md > CHANGELOG.md + cat CHANGELOG.md + - run: + name: Create GH release + command: | + VERSION=$(cat VERSION) + ghr -draft -t $GITHUB_BOT_PAT -c $CIRCLE_SHA1 -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -b "$(cat CHANGELOG.md)" -n "pack-orb ${VERSION}" $VERSION diff --git a/.github_changelog_generator b/.github_changelog_generator new file mode 100644 index 0000000..46d1d42 --- /dev/null +++ b/.github_changelog_generator @@ -0,0 +1,6 @@ +unreleased-only=true +issues=false +bugs-label=Fixes: +bug-labels=type/bug +header-label=## Changelog +usernames-as-github-logins=true \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1b763b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +CHANGELOG.md diff --git a/README.md b/README.md index cd2fe07..95bf993 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,7 @@ See the [documentation on the CircleCI Orb Registry](https://circleci.com/orbs/r ## Releasing -Create a tag a push it: - -``` -$ git tag x.y.z -$ git push --tags -``` - -Check [CircleCI](https://circleci.com/gh/buildpacks/pack-orb) to manually approve the release workflow. \ No newline at end of file +1. Create a `release/<#.#.#>` branch + - `<#.#.#>` will be the version released +2. Check [CircleCI](https://circleci.com/gh/buildpacks/pack-orb) to manually approve the release workflow. +3. Check [releases](https://github.com/buildpacks/pack-orb/releases) and publish release draft. \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..f477849 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.2.2 \ No newline at end of file