Skip to content

build

build #132

Workflow file for this run

name: build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.cache/coursier/v1
key: ${{ runner.os }}-coursier-${{ hashFiles('**/build.sbt') }}
- name: Set up java
uses: actions/[email protected]
with:
distribution: adopt
java-version: 17
java-package: jre
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sbt compile
- name: Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sbt test
- name: Build distributable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sbt cmdJVM/stage
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push cmd images
uses: docker/build-push-action@v2
with:
context: cmd
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/torrentdam/cmd:latest
build-native:
if: false
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.cache/coursier/v1
key: ${{ runner.os }}-coursier-${{ hashFiles('**/build.sbt') }}
- name: Set up java
uses: actions/[email protected]
with:
distribution: adopt
java-version: 17
java-package: jre
- name: Build Native
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sbt -J-Xmx4g cmdNative/nativeLink
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push cmd images
uses: docker/build-push-action@v2
with:
context: cmd
file: cmd/Dockerfile-native
platforms: linux/amd64
push: true
tags: ghcr.io/torrentdam/cmd-native:latest
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up java
uses: actions/[email protected]
with:
distribution: adopt
java-version: 17
java-package: jre
- name: Release
env:
SONATYPE_CREDS: ${{ secrets.SONATYPE_CREDS }}
PGP_SECRET_KEY: ${{ secrets.PGP_SECRET_KEY }}
run: |
echo ${PGP_SECRET_KEY} | base64 --decode | gpg --import
gpg --list-secret-keys
export VERSION=${GITHUB_REF#*/v}
echo Publishing $VERSION
sbt commonJVM/publishSigned
sbt commonJS/publishSigned
sbt bittorrentJVM/publishSigned
sbt dhtJVM/publishSigned
sbt cmdJVM/publishSigned