Add a GitHub action for the release. #12
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: Release | |
on: | |
workflow_dispatch: | |
# temporary | |
pull_request: | |
branches: [ main ] | |
jobs: | |
release-sbt: | |
runs-on: ubuntu-latest | |
name: Release Scala Artifacts | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Setup Scala | |
uses: olafurpg/setup-scala@v14 | |
with: | |
java-version: "adopt@1.8" | |
- name: Import GPG Key | |
shell: bash | |
run: | | |
echo "${{ secrets.SONATYPE_GPG_KEY }}" > gpg-secret-key.asc | |
gpg --import --batch gpg-secret-key.asc && rm -rf gpg-secret-key.asc | |
mkdir -p ~/.gnupg | |
echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf | |
git config --global user.email "absa_ci_cd_bot@absa.africa" | |
git config --global user.name "CI/CD bot" | |
- name: Setup SonaType config | |
shell: bash | |
run: | | |
mkdir -p ~/.sbt/1.0 | |
echo "${{ secrets.SONATYPE_CONFIG }}" | base64 --decode > ~/.sbt/1.0/sonatype.sbt | |
- name: Preare the release branch | |
shell: bash | |
working-directory: ./pramen | |
run: | | |
VERSION=$(grep "ThisBuild / version" version.sbt | cut -d\" -f2) | |
git checkout -b release/$VERSION | |
git push | |
- name: Run the release plugin | |
shell: bash | |
working-directory: ./pramen | |
run: | | |
export GPG_TTY=$(tty) | |
export PGP_PASSPHRASE="${{ secrets.PGP_PASSPHRASE }}" | |
sbt releaseNow | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
commit-message: "Release version ${{ steps.release.outputs.version }}" | |
branch: release/${{ steps.release.outputs.version }} | |
title: "Release version ${{ steps.release.outputs.version }}" | |
body: "Automated release created by GitHub Action." | |
token: ${{ secrets.GITHUB_TOKEN }} |