Skip to content

Commit

Permalink
ci(snapshot): publish snapshot builds on merge to main (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores authored Aug 7, 2024
1 parent 5e9fbe3 commit 8630606
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,22 @@ jobs:
- uses: skjolber/maven-cache-github-action@v1
with:
step: save

get-version:
runs-on: ubuntu-latest
outputs:
project-version: ${{ steps.get-version.outputs.project-version }}
steps:
- uses: actions/checkout@v4
- id: get-version
run: |
PROJECT_VERSION="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
echo "project-version=${PROJECT_VERSION}" >> "${GITHUB_OUTPUT}"
publish-snapshot:
needs: get-version
uses: ./.github/workflows/maven-central-publish.yml
secrets: inherit
with:
publish-cmd: './release-snapshot.sh'
if: ${{ github.repository_owner == 'cryostatio' && endsWith(needs.get-version.outputs.project-version, '-SNAPSHOT') }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
name: Publish a new Maven Central release

on:
workflow_dispatch:
# inputs:
# version:
# description: 'Release version'
# required: true
push:
branches:
- main
- v[0-9]+
- v[0-9]+.[0-9]+
- cryostat-v[0-9]+.[0-9]+
workflow_call:
inputs:
publish-cmd:
description: 'Command to perform publish'
required: true
type: string

jobs:
build:
Expand Down Expand Up @@ -41,4 +36,4 @@ jobs:
JRELEASER_NEXUS2_USERNAME: ${{ secrets.MAVEN_CENTRAL_NEXUS2_USERNAME }}
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.MAVEN_CENTRAL_NEXUS2_PASSWORD }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.SUBMODULE_TOKEN }}
run: ./release.sh
run: ${{ inputs.publish-cmd }}
11 changes: 11 additions & 0 deletions release-snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

echo "📦 Staging artifacts..."
./mvnw --batch-mode --no-transfer-progress -Ppublication -DskipTests=true -Dskip.spotless=true

echo "🚀 Releasing..."
./mvnw --batch-mode --no-transfer-progress -Prelease jreleaser:deploy

echo "🎉 Done!"

0 comments on commit 8630606

Please sign in to comment.