Skip to content

Publish Library

Publish Library #39

Workflow file for this run

name: Publish Library
on:
push:
tags:
- "v*"
jobs:
build:
name: Publish
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.12]
java: [[email protected]]
runs-on: harana-dev-linux
steps:
- name: Cleanup Ref
id: ref
uses: frabert/[email protected]
with:
pattern: 'refs\/\w+\/(.*)'
string: ${{ github.ref }}
replace-with: '$1'
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Cache
run: |
mkdir -p /opt/cache/coursier_cache
mkdir -p /opt/cache/ivy2_cache
mkdir -p /opt/cache/sbt_cache
rm -fr /home/runner/.cache ; mkdir /home/runner/.cache
rm -fr /home/runner/.ivy2 ; mkdir /home/runner/.ivy2
rm -fr /home/runner/.sbt ; mkdir /home/runner/.sbt
ln -s /opt/cache/coursier_cache /home/runner/.cache/coursier
ln -s /opt/cache/ivy2_cache /home/runner/.ivy2/cache
ln -s /opt/cache/sbt_cache /home/runner/.sbt/boot
- name: Populate Credentials
run: |
mkdir -p /home/runner/.sbt/1.0/plugins
if [ ! -f '/home/runner/.sbt/1.0/plugins/credentials.sbt' ]; then
cat <<EOF > /home/runner/.sbt/1.0/plugins/credentials.sbt
credentials += Credentials("GitHub Package Registry", "maven.pkg.github.com", "nadenf", System.getenv("GITHUB_TOKEN"))
EOF
fi
- name: Install JS Dependencies
run: |
if [ -f 'js/package.json' ]; then
cd js
pnpm install
cd ..
fi
- name: Publish Packages
env:
GITHUB_TOKEN: ${{ secrets.WRITE_PACKAGES_TOKEN }}
run: sbt publish
- name: Get Scala Major Version
id: scala
uses: actions-ecosystem/action-regex-match@v2
with:
regex: '([0-9]+\.[0-9]+)\.[0-9]+'
text: ${{ matrix.scala }}
- name: Remove Older Snapshots
uses: smartsquaregmbh/[email protected]
with:
keep: 2
version-pattern: ".+?SNAPSHOT"
names: |
com.harana.${{ github.event.repository.name }}_${{ steps.scala.outputs.group1 }}
com.harana.${{ github.event.repository.name }}JS_${{ steps.scala.outputs.group1 }}
- name: Remove Older Releases
uses: smartsquaregmbh/[email protected]
with:
keep: 2
version-pattern: .*[^SNAPSHOT]$
names: |
com.harana.${{ github.event.repository.name }}_${{ steps.scala.outputs.group1 }}
com.harana.${{ github.event.repository.name }}JS_${{ steps.scala.outputs.group1 }}
- name: Cleanup
if: always()
run: |
rm -fr /home/runner/.sbt/1.0/plugins/credentials.sbt
- name: Notify Slack - Success
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_FOOTER: ""
SLACK_MESSAGE: "✅ ${{ github.event.repository.name }} | publish | ${{ steps.ref.outputs.replaced }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_BUILDS_WEBHOOK }}
- name: Notify Slack - Failure
if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_FOOTER: ""
SLACK_MESSAGE: "⛔️ ${{ github.event.repository.name }} | publish | ${{ steps.ref.outputs.replaced }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_BUILDS_WEBHOOK }}