Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI deploy snapshot for a branch #817

Merged
merged 7 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions .github/workflows/branch-snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GitHub Build Actions To Build a Branch Specific Snapshot
name: Build a Branch Specific Snapshot

on:
workflow_dispatch:
Expand All @@ -8,6 +8,7 @@ jobs:
runs-on: ubuntu-latest
env:
BUILD_EVENT: ${{ github.event_name }}
BRANCH_SNAPSHOT: ${{ github.ref_name }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
Expand All @@ -16,9 +17,36 @@ jobs:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GODEBUG: x509sha1=1
steps:
- name: Set env.BRANCH
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
- name: Debug
- name: Setup JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Setup GO
uses: actions/setup-go@v2
with:
go-version: 1.19.1
- name: Install Nats Server
run: |
echo ${{env.BRANCH}}
echo ${{GITHUB_REF}}
cd $GITHUB_WORKSPACE
git clone https://github.com/nats-io/nats-server.git
cd nats-server
go get
go build main.go
mkdir -p ~/.local/bin
cp main ~/.local/bin/nats-server
cd ..
rm -rf nats-server
nats-server -v
- name: Check out code
uses: actions/checkout@v2
- name: Build and Test
run: chmod +x gradlew && ./gradlew clean test jacocoTestReport coveralls
- name: Verify Javadoc
if: ${{ success() }}
run: ./gradlew javadoc
- name: Publish Branch Snapshot
if: ${{ success() }}
run: ./gradlew -i publishToSonatype


2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GitHub Build Actions For JNats NATS.io Java Client
name: Build for Pr, Merge or Tag

on:
pull_request:
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ plugins {
def jarVersion = "2.16.6"

def isRelease = System.getenv("BUILD_EVENT") == "release"
def bs = System.getenv("BRANCH_SNAPSHOT")
def snap = bs == null || bs.equals("") ? "-SNAPSHOT" : "." + bs + "-SNAPSHOT"

println "snap is " + snap

// version is the variable the build actually uses.
version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT"
version = isRelease ? jarVersion : jarVersion + snap

archivesBaseName = 'jnats'
group = 'io.nats'
Expand Down