Skip to content

Commit

Permalink
Add snapshot and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dengliming committed Sep 29, 2024
1 parent 885bba3 commit af8c4c1
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Snapshot
on:
push:
branches:
- master
workflow_dispatch:

jobs:
snapshot:
name: Deploy Snapshot
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up publishing to maven central
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: mvn offline
run: |
mvn -q dependency:go-offline
- name: deploy
run: |
mvn --no-transfer-progress -DskipTests deploy
env:
MAVEN_USERNAME: ${{secrets.OSSRH_USER}}
MAVEN_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
48 changes: 48 additions & 0 deletions .github/workflows/version-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release
on:
release:
types: [published]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Set up Java with Maven cache

uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Update version in Maven configuration
run: |
mvn --no-transfer-progress \
--batch-mode \
versions:set -DnewVersion=${{ github.event.release.tag_name }}
if: ${{ github.event.release.tag_name }}

- name: Install GPG key

run: |
cat <(echo -e "${{ secrets.OSSH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Publish to Maven

run: |
mvn --no-transfer-progress \
--batch-mode \
-Dgpg.passphrase='${{ secrets.OSSH_GPG_SECRET_KEY_PASSWORD }}' \
-DskipTests deploy
env:
MAVEN_USERNAME: ${{secrets.OSSRH_USER}}
MAVEN_PASSWORD: ${{secrets.OSSRH_PASSWORD}}

0 comments on commit af8c4c1

Please sign in to comment.