Skip to content

Commit

Permalink
Merge pull request #4 from trocco-io/feature/auto-deploy-gem
Browse files Browse the repository at this point in the history
Implement GitHub Actions workflow for publishing Gem to GitHub Packages
  • Loading branch information
d-hrs authored Mar 25, 2024
2 parents 04ec6c6 + cb2bc30 commit 14db3db
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: main

on:
workflow_dispatch:
push:
branches:
- "master"
tags:
- "*"
pull_request:
branches:
- "master"
types: [ opened, synchronize ]

jobs:
main:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: lint
# Run ./gradlew spotlessApply when failing on this step.
run: ./gradlew spotlessCheck
- run: ./gradlew test
- name: Show Current Version
run: ./gradlew printVersion
- name: Build Gem & Put it into './pkg/' Directory
run: ./gradlew gem
- name: Set up JRuby
uses: ruby/setup-ruby@v1
with:
ruby-version: jruby
- name: push gem
uses: trocco-io/push-gem-to-gpr-action@v1
with:
language: java
gem-path: "./pkg/*.gem"
github-token: "${{ secrets.GITHUB_TOKEN }}"
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
plugins {
id "com.jfrog.bintray" version "1.1"
id "com.github.jruby-gradle.base" version "1.5.0"
id "com.palantir.git-version" version "0.12.3"
id "com.diffplug.spotless" version "6.13.0"
id "java"
id "checkstyle"
}
Expand All @@ -14,7 +16,15 @@ configurations {
provided
}

version = "0.0.4"
version = {
def vd = versionDetails()
if (vd.commitDistance == 0 && vd.lastTag ==~ /^[0-9]+\.[0-9]+\.[0-9]?/) {
vd.lastTag
}
else {
"0.0.0.${vd.gitHash}"
}
}()

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.4-bin.zip

0 comments on commit 14db3db

Please sign in to comment.