Skip to content

Commit

Permalink
Use GitHub Actions for build and release (#96)
Browse files Browse the repository at this point in the history
* Use GitHub Actions for build and release

* Add empty properties and run tests
  • Loading branch information
stiankri committed May 7, 2021
1 parent 43cdad2 commit 1130dbf
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,21 @@
name: Build gradle project

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install JDK
run: ./script/installjdk
- name: Build with Gradle
run: ./gradlew -PossrhUsername="" -PossrhPassword="" test
env:
JAVA_HOME: /home/runner/corretto-8/
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,41 @@
name: Create release of CLI

on:
push:
tags:
- '*'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install JDK
run: ./script/installjdk
- name: Build with Gradle
run: ./gradlew -PossrhUsername="" -PossrhPassword="" cliTar
env:
JAVA_HOME: /home/runner/corretto-8/
GITHUB_REF: ${{ github.ref }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cli/build/distributions/strongbox-cli.tar.gz
asset_name: strongbox-cli.tar.gz
asset_content_type: application/x-gzip
4 changes: 2 additions & 2 deletions cli/build.gradle
Expand Up @@ -16,7 +16,7 @@ apply plugin: 'nebula.deb'
apply plugin: 'signing'

mainClassName = 'com.schibsted.security.strongbox.cli.StrongboxCLI'
version = getenv('TRAVIS_TAG') ? getenv('TRAVIS_TAG') : "0.0.1";
version = getenv('GITHUB_REF') ? getenv('GITHUB_REF').replace("refs/tags/","") : "0.0.1";

dependencies {
compile project(':sdk')
Expand Down Expand Up @@ -118,7 +118,7 @@ task cliRpm(type: Rpm, dependsOn: "installDist") {
task cliTar(type: Tar, dependsOn: "installDist") {
from(installDist)
into('strongbox-cli')
archiveName = 'strongbox-cli-' + version + '.tar.gz'
archiveName = 'strongbox-cli.tar.gz'

extension = 'tar.gz'
compression = Compression.GZIP
Expand Down
1 change: 1 addition & 0 deletions script/installjdk
Expand Up @@ -17,3 +17,4 @@ cd $CWD

export JAVA_HOME=$BASE
export PATH=$JAVA_HOME/bin:$PATH
echo "$JAVA_HOME/bin" >> $GITHUB_PATH

0 comments on commit 1130dbf

Please sign in to comment.