Update gh actions #131
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- "*.*.*" | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Startup MySQL service | |
run: sudo /etc/init.d/mysql start | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Set Env | |
if: ${{ github.repository == 'lucidsoftware/piezo' }} | |
run: | | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
version="${GITHUB_REF#refs/tags/}" | |
else | |
version="${GITHUB_REF##*/}-SNAPSHOT" | |
fi | |
echo "VERSION=$version" >> $GITHUB_ENV | |
echo "SBT_OPTS=-Dbuild.version=$version" >> $GITHUB_ENV | |
- name: Test | |
run: sbt compile test doc Debian/packageBin | |
- name: Publish to Sonatype | |
if: ${{ github.repository == 'lucidsoftware/piezo' && github.event_name != 'pull_request' }} | |
env: | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: | | |
echo "$PGP_SECRET" | base64 --decode | gpg --import | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
sbt '; publishSigned; sonatypeBundleRelease' | |
else | |
sbt publishSigned | |
fi | |
# TODO: publish deb somewhere? | |
- name: Upload assets to Github | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -x | |
sbt Universal/packageBin | |
gh release create -t "Release $VERSION" --generate-notes $VERSION {admin,worker}/target/**/*.jar admin/target/*.deb admin/target/universal/piezo-admin*.zip |