Updated scommons website url #20
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: | |
push: | |
paths-ignore: | |
- '*.md' | |
branches: [ master ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout (merge) | |
uses: actions/checkout@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
fetch-depth: 0 | |
- name: Git checkout (PR) | |
uses: actions/checkout@v3 | |
if: github.event_name == 'pull_request' | |
with: | |
fetch-depth: 0 | |
# see: https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
cache: 'sbt' | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
~/.nvm | |
~/work/scommons-admin/scommons-admin/client/target/scala-2.13/scalajs-bundler/main/node_modules | |
~/work/scommons-admin/scommons-admin/client/target/scala-2.13/scalajs-bundler/main/package-lock.json | |
~/work/scommons-admin/scommons-admin/client/target/scala-2.13/scalajs-bundler/test/node_modules | |
~/work/scommons-admin/scommons-admin/client/target/scala-2.13/scalajs-bundler/test/package-lock.json | |
key: ${{ runner.os }}-node_modules-cache-v3-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules-cache-v3- | |
- name: Extract Tag Name | |
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
- name: Run tests | |
run: | | |
sbt "project scommons-admin-server" coverage test it:test | |
sbt ";project scommons-admin-server ;set Test / test := {} ;project scommons-admin" coverage test | |
sbt coverageAggregate coveralls | |
if: ${{ env.TAG_NAME == '' }} | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
- name: Publish SNAPSHOT | |
run: | | |
VERSION="SNAPSHOT" | |
echo "Publish version=$VERSION" | |
version=$VERSION sbt clean ";set Global / scalaJSStage := FullOptStage ;project scommons-admin-server" docker:publishLocal | |
docker tag scommons-admin-server:$VERSION scommons/admin:$VERSION | |
docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_TOKEN | |
docker push scommons/admin:$VERSION | |
if: ${{ !github.event.pull_request && env.TAG_NAME == '' }} | |
env: | |
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} | |
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Publish RELEASE | |
run: | | |
VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)" | |
echo "Publish a release version=$VERSION for tag $TAG_NAME" | |
version=$VERSION sbt clean ";set Global / scalaJSStage := FullOptStage ;project scommons-admin-server" docker:publishLocal | |
docker tag scommons-admin-server:$VERSION scommons/admin:$VERSION | |
docker tag scommons/admin:$VERSION scommons/admin:latest | |
docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_TOKEN | |
docker push scommons/admin:$VERSION | |
docker push scommons/admin:latest | |
if: ${{ env.TAG_NAME != '' }} | |
env: | |
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} | |
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} |