Skip to content

Commit

Permalink
Merge pull request #6 from olibye/release-dev-ops
Browse files Browse the repository at this point in the history
Release dev ops
  • Loading branch information
olibye authored Mar 10, 2024
2 parents bcb9ffa + 2319bee commit 19afc34
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Maven deploy release
on:
pull_request:
types:
- opened
branches:
- 'master' # only trigger from master
jobs:
run_if:
if: startsWith(github.head_ref, 'releases/') # targeting releases
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven

- name: Split branch into release version
env:
BRANCH: ${{ github.ref_name }}
id: split
run: echo "::set-output name=fragment::${BRANCH##*/}"

- name: Maven set release version
run: |
mvn versions:set -DoldVersion=\* -DnewVersion=${{ steps.split.outputs.fragment }} -DgroupId=org.jmock -DgenerateBackupPoms=false
git commit --no-edit
git tag -a -m "Release version ${{ steps.split.outputs.fragment }}" ${{ steps.split.outputs.fragment }}
git push origin HEAD --tags
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Maven deploy to Maven Central
name: Maven deploy snapshot
on:
push:
# Pattern matched against refs/tags
tags:
- '*' # Push events to every tag not containing /
release:
types: [created]
branches: [ master ]
jobs:
publish:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 19afc34

Please sign in to comment.