Publish release 1.2.1-SNAPSHOT #8
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: Build and Publish release | |
run-name: Publish release ${{ github.event.inputs.release || '' }} | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'Release version only used for run name. Actual release version is taken from version.sbt' | |
required: false | |
type: string | |
build: | |
description: 'Build version' | |
required: true | |
type: boolean | |
default: true | |
publish: | |
description: 'Publish version' | |
required: true | |
type: boolean | |
default: true | |
tag: | |
description: 'Tag version' | |
required: true | |
type: boolean | |
default: true | |
permissions: | |
contents: write | |
jobs: | |
publish-artifacts: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Import GPG key | |
if : ${{ github.event.inputs.publish == 'true' }} | |
run: | | |
echo "${{ secrets.PGP_SECRET }}" | gpg --batch --import | |
env: | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: temurin | |
cache: sbt | |
- name: Build project | |
if : ${{ github.event.inputs.build == 'true' }} | |
run: ./build.sh | |
- name: Publish Signed Artifacts | |
if : ${{ github.event.inputs.publish == 'true' }} | |
run: sbt +publishSigned | |
env: | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
- name: Tag branch | |
if : ${{ github.event.inputs.tag == 'true' }} | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "[email protected]" | |
echo "VERSION_TAG=$(grep 'version := ' version.sbt | sed -E 's/version := \"(.*)\"/\1/')" >> $GITHUB_ENV | |
git tag -a "v${{ env.VERSION_TAG }}" -m "Release ${{ env.VERSION_TAG }}" | |
git push origin "v${{ env.VERSION_TAG }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |