Skip to content

Commit

Permalink
ci: add deploy snapshot workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kang8 committed Aug 7, 2021
1 parent af8fda7 commit 0678202
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/deploy-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy SNAPSHOT

on:
push:
branches: [ dev ]
paths:
- src/**
- pom.xml
pull_request:
branches: [ dev ]
paths:
- src/**
- pom.xml

jobs:
get-latest-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.2.0
- name: Set up Java and Maven
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Cache m2 package
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: get current project version to set env.VERSION
run: echo "VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`" >> $GITHUB_ENV
- name: set snapshot version
if: ${{ !endsWith( env.VERSION , '-SNAPSHOT') }}
run: mvn versions:set -DnewVersion=${{ env.VERSION }}-SNAPSHOT
- name: deploy snapshot to ossrh repository
run: mvn -B deploy -P snapshot
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

0 comments on commit 0678202

Please sign in to comment.