Skip to content

Release (0.1.0-SNAPSHOT) #5

Release (0.1.0-SNAPSHOT)

Release (0.1.0-SNAPSHOT) #5

Workflow file for this run

name: Release
run-name: "Release${{ inputs.version && format(' ({0})', inputs.version) || format(' (auto: {0})', github.ref_name) }}"
on:
release:
types:
- released
workflow_dispatch:
inputs:
module:
type: choice
description: Which module to release
options:
- From Tag
- scala-pekko-http
version:
type: input
description: 'What version to use (default: derive from git)'
jobs:
publish:
name: 'Publish release'
runs-on: ubuntu-20.04
steps:
- name: 'Extract project from tag'
id: set-project-from-tag
run: |
module="${{ github.event.inputs.module }}"
if [ -z "$module" ] || [ "$module" = "From Tag" ]; then
module="$(echo "$GITHUB_REF" | sed 's~^refs/tags/\(.*\)-v[0-9.]\+$~\1~')"
echo "extract project: ${GITHUB_REF}, ${module}"
else
echo "Using supplied module: $module"
fi
echo "module=$module" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 14
- name: 'Print versions'
run: |
java -version
gpg --version
- name: Incorporate version override
id: version-override
run: |
version="${{github.event.inputs.version}}"
if [ -n "$version" ]; then
# -Dproject.version permits overriding version
# https://github.com/sbt/sbt-git/blob/HEAD/src/main/scala/com/github/sbt/git/GitPlugin.scala#L183
echo "JAVA_OPTS=-Dproject.version=$version" >> $GITHUB_OUTPUT
fi
- name: 'Publish artifacts [scala-pekko-http]'
if: ${{ steps.set-project-from-tag.outputs.module == 'scala-pekko-http' }}
# run: sbt 'show version' "project guardrail-scala-pekko-http" clean compile versionCheck test ci-release
run: sbt 'show version' "project guardrail-scala-pekko-http" clean compile versionCheck ci-release
env:
JAVA_OPTS: ${{ steps.version-override.outputs.JAVA_OPTS }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GUARDRAIL_RELEASE_MODULE: ${{ steps.set-project-from-tag.outputs.module }}