Skip to content

Commit

Permalink
Merge pull request #8 from coreywoodfield/github-actions
Browse files Browse the repository at this point in the history
Switch from travis to github actions
  • Loading branch information
tmccombs committed Feb 23, 2024
2 parents aac2a64 + 8dc0791 commit 0224382
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 33 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI
on:
pull_request:
push:
branches:
- master
tags:
- "*.*"

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: corretto
- uses: actions/cache@v3
with:
path: |
~/.ivy2
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
- name: Set SBT_OPTS
run: bash generate_sbt_opts.sh
- name: Build
run: sbt package
- uses: actions/upload-artifact@v3
with:
name: jars
path: '*/target/*.jar'
retention-days: 1
- name: Test
run: sbt test
publish:
if: ${{ github.event_name != 'pull_request' }} && (github.repository == 'lucidsoftware/akka-thread-context')
needs: build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.ivy2
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
- name: Set SBT_OPTS
run: bash generate_sbt_opts.sh
- name: Publish to Sonatype
run: bash publish.sh
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
release:
if: ${{ startsWith(github.ref, 'refs/tags') && (github.repository == 'lucidsoftware/akka-thread-context') }}
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifacts@v3
with:
name: jars
- name: Upload Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
 tag="${GITHUB_REF#refs/tags/}"
 targets=($(printf -- "-a %s " */target/*.jar))
 hub release create "${targets[@]}" -m "Release $tag" $tag
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
.bsp

target/
target-*/
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions akka-actor-thread-context/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.6.15",
"com.lucidchart" % "thread-context" % "0.7"
)
publishTo := sonatypePublishToBundle.value
3 changes: 1 addition & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ inScope(Global)(Seq(
organization := "com.lucidchart",
organizationHomepage := Some(url("http://github.com/lucidsoftware")),
organizationName := "Lucid Software",
PgpKeys.pgpPassphrase := Some(Array.emptyCharArray),
resolvers += Resolver.typesafeRepo("releases"),
scalaVersion := "2.13.6",
scmInfo := Some(ScmInfo(
Expand All @@ -25,4 +24,4 @@ inScope(Global)(Seq(
version := sys.props.getOrElse("build.version", "0-SNAPSHOT")
))

publishTo := sonatypePublishToBundle.value
publish / skip := true
7 changes: 7 additions & 0 deletions generate_sbt_opts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
if [[ $GITHUB_REF_TYPE = tag ]]; then
version="${GITHUB_REF_NAME}"
else
version="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}-SNAPSHOT"
fi
echo "SBT_OPTS=-Dbuild.version=$version" >> $GITHUB_ENV
11 changes: 11 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e

echo "$PGP_SECRET" | base64 --decode | gpg --import
if [[ $GITHUB_REF == refs/tags/* ]]; then
command="; publishSigned; sonatypeBundleRelease"
else
command="publishSigned"
fi
echo "Running: sbt \"$command\""
exec sbt "$command"

0 comments on commit 0224382

Please sign in to comment.