-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from blast-hardcheese/auto-tag-version
Copy over auto-tagging functionality from sbt-guardrail
- Loading branch information
Showing
3 changed files
with
83 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name-template: 'v$RESOLVED_VERSION' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
categories: | ||
- title: '🚀 Features' | ||
labels: | ||
- 'enhancement' | ||
- title: '🐛 Bug Fixes' | ||
labels: | ||
- 'bug' | ||
- title: '🧰 Maintenance' | ||
label: 'chore' | ||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. | ||
template: | | ||
## Changes | ||
$CHANGES | ||
## Contributors | ||
Thanks to $CONTRIBUTORS for your contributions to this release! |
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,45 @@ | ||
name: Tag release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: [ '8' ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
- name: print Java version | ||
run: java -version | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Guess next version based on the library version | ||
id: guessversion | ||
run: | | ||
source scripts/next-version.sh | ||
echo "::set-output name=exists::${exists}" | ||
echo "VERSION=${version}" >> $GITHUB_ENV | ||
- name: Publish release notes | ||
if: steps.guessversion.outputs.exists == 0 | ||
uses: release-drafter/release-drafter@v5 | ||
with: | ||
publish: true | ||
name: "v${{ env.VERSION }}" | ||
tag: "v${{ env.VERSION }}" | ||
version: "v${{ env.VERSION }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,17 @@ | ||
# next-version.sh | ||
# Guess the next version of the sbt-guardrail plugin based on the current library dependency | ||
# Ideally, this'll let actions automatically tag and release. | ||
# | ||
# Strategy is to pull the com.twilio %% guardrail % <VERSION>, | ||
# ... check to see if a tag with that version exists, | ||
# ... if so, exit 1 | ||
# ... if not, emit that version to stdout | ||
|
||
# Extract library version | ||
version="$(grep -ho 'com.twilio:guardrail_2.12:[^"]*"' build.gradle | grep -ho '\<\([0-9]\+\)\(\.[0-9]\+\)\{1,\}')" | ||
|
||
exists=0 | ||
# Check to see if we've already released for this library version | ||
if git rev-parse "v${version}" >/dev/null 2>&1; then | ||
exists=1 | ||
fi |