Release #13
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: 'Publish Release' | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
sbt_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: corretto | ||
java-version: 11 | ||
cache: sbt | ||
- name: Use supplied version | ||
if: ${{ inputs.version != '' }} | ||
shell: bash | ||
run: | | ||
echo "VERSION=${{ inputs.version }}" >> "$GITHUB_ENV" | ||
- name: Get version to publish as | ||
if: ${{ inputs.version == '' }} | ||
shell: bash | ||
run: | | ||
git describe --tags --exact-match HEAD || exit 1 | ||
VERSION=$(git describe --tags | cut -f2 -d"@") | ||
if [[ ${VERSION:0:1} == "v" ]] ; then | ||
VERSION=${VERSION:1} | ||
fi | ||
echo "VERSION=${VERSION}" >> "$GITHUB_ENV" | ||
- name: Optionally set snapshot version | ||
if: ${{ inputs.isSnapshot != 'false' }} | ||
shell: bash | ||
run: | | ||
if [[ ${VERSION: -9} != "-SNAPSHOT" ]] ; then | ||
echo "Version must end in -SNAPSHOT. Adding -SNAPSHOT suffix" | ||
VERSION="$VERSION-SNAPSHOT" | ||
fi | ||
echo "VERSION=${VERSION}" >> "$GITHUB_ENV" | ||
- name: Import PGP key if there is one | ||
if: ${{ secrets.PGP_SECRET != '' }} | ||
Check failure on line 40 in .github/workflows/release.yml GitHub Actions / Publish ReleaseInvalid workflow file
|
||
shell: bash | ||
run: "echo $PGP_SECRET | base64 --decode | gpg --batch --import" | ||
env: | ||
PGP_SECRET: ${{ secrets.PGP_SECRET }} | ||
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | ||
- name: Run sbt release | ||
shell: bash | ||
run: | | ||
export GPG_TTY=$(tty) | ||
RELEASE_TYPE="${{ github.event.release.prerelease && 'snapshot' || 'production' }}" | ||
echo "Releasing version $VERSION Sonatype as $RELEASE_TYPE" | ||
sbt -DRELEASE_TYPE=$RELEASE_TYPE "clean" "release cross release-version $VERSION with-defaults" | ||
env: | ||
PGP_SECRET: ${{ secrets.PGP_SECRET }} | ||
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
CAPI_TEST_KEY: ${{ secrets.CAPI_TEST_KEY }} | ||
isSnapshot: ${{ github.event.release.prerelease }} |