Update sbt-sonatype to 3.11.2 #147
Workflow file for this run
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
name: Create snapshot/release | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
tags: | |
- v[0-9].[0-9]+.[0-9]+ | |
jobs: | |
publish: | |
name: Publish libraries | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache SBT | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.sbt/boot | |
~/.cache/coursier | |
**/target | |
!target/sonatype-staging | |
key: bootstrap-sbt | |
- name: Check event source | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
run: | | |
if [[ "${{github.event_name}}" == "pull_request" ]]; then | |
event=pull_request | |
elif [[ "${{github.ref}}" == "refs/tags/"* ]]; then | |
event=release | |
else | |
event=snapshot | |
fi | |
echo "::set-env name=event::$event" | |
- name: Set version | |
id: version | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
run: | | |
if [[ "${{github.event_name}}" == "pull_request" ]]; then | |
ref="${{github.head_ref}}" | |
echo "$(pwd)" | |
git fetch --prune --unshallow | |
git checkout "$ref" | |
version=$(./setversion.sh "PR${{ github.event.number }}") | |
elif [[ "${{github.ref}}" == "refs/tags/"* ]]; then | |
version=$(./setversion.sh release) | |
else | |
git fetch --prune --unshallow | |
git checkout master | |
version=$(./setversion.sh snapshot) | |
fi | |
if test -z "$version"; then exit 1; fi | |
echo $version | |
echo "::set-env name=version::$version" | |
if [[ ${{github.ref}} != "refs/tags/"* ]]; then | |
echo Deploying as snapshot | |
echo '::set-env name=is_snapshot::true' | |
else | |
echo '::set-env name=is_snapshot::false' | |
fi | |
- name: Install GPG key | |
run: | | |
echo '${{ secrets.OSSRH_GPG_KEY }}' > secret.gpg | |
echo '${{ secrets.OSSRH_GPG_PASSPHRASE }}' | gpg --batch --yes --passphrase-fd 0 --import secret.gpg | |
- name: Set SBT credentials | |
run: | | |
mkdir -p ~/.sbt/1.0/plugins | |
echo 'addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.1")' > ~/.sbt/1.0/plugins/sonatype.sbt | |
echo 'addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")' > ~/.sbt/1.0/plugins/gpg.sbt | |
echo 'credentials += Credentials("Sonatype Nexus Repository Manager", | |
"oss.sonatype.org", | |
"${{ secrets.OSSRH_USERNAME }}", | |
"${{ secrets.OSSRH_PASSWORD }}")' > ~/.sbt/1.0/sonatype.sbt | |
- name: Release SBT package | |
run: | | |
# See https://github.com/sbt/sbt-pgp/issues/173 | |
echo '#! /bin/sh | |
gpg --pinentry-mode loopback $@' > gpg.sh | |
chmod +x gpg.sh | |
sbt -J-DSCALAJS_VERSION=0.6.33 'set Global/PgpKeys.gpgCommand := (baseDirectory.value / "gpg.sh").getAbsolutePath; | |
set ThisBuild/version := "${{ env.version }}"; | |
set ThisBuild/isSnapshot := ${{ env.is_snapshot }}; | |
set pgpPassphrase := Some("${{ secrets.OSSRH_GPG_PASSPHRASE }}".toCharArray); | |
+publishSigned' | |
sbt 'set Global/PgpKeys.gpgCommand := (baseDirectory.value / "gpg.sh").getAbsolutePath; | |
set ThisBuild/version := "${{ env.version }}"; | |
set ThisBuild/isSnapshot := ${{ env.is_snapshot }}; | |
set pgpPassphrase := Some("${{ secrets.OSSRH_GPG_PASSPHRASE }}".toCharArray); | |
+publishSigned' | |
if [[ "${{ env.is_snapshot }}" == "false" ]]; then | |
sbt 'set ThisBuild/version := "${{ env.version }}"; | |
sonatypeBundleRelease' | |
fi | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build Changelog | |
id: github_release | |
uses: mikepenz/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
commitMode: true | |
configurationJson: | | |
{ | |
"template": "#{{CHANGELOG}}\n\n### ✨ Uncategorized\n#{{UNCATEGORIZED}}", | |
"categories": [ | |
{ | |
"title": "## 🚀 Features", | |
"labels": ["feature", "features"] | |
}, | |
{ | |
"title": "## 🐛 Fixes", | |
"labels": ["fix", "fixes"] | |
}, | |
{ | |
"title": "## 🧪 Other", | |
"labels": ["other"] | |
}, | |
{ | |
"title": "## 📦 Dependencies", | |
"labels": ["dependencies"] | |
} | |
], | |
"sort": "ASC", | |
"pr_template": "- #{{TITLE}}", | |
"empty_template": "- no changes", | |
"label_extractor": [ | |
{ | |
"pattern": "\\[(.*)\\].*", | |
"target": "$1" | |
} | |
], | |
"transformers": [ | |
{ | |
"pattern": "\\[.*\\] (.*)", | |
"target": "$1" | |
} | |
], | |
"max_tags_to_fetch": 200, | |
"max_pull_requests": 200, | |
"max_back_track_time_days": 365 | |
} | |
- name: Create Release | |
uses: mikepenz/[email protected] #softprops/action-gh-release | |
with: | |
body: ${{steps.github_release.outputs.changelog}} |