Skip to content

Commit

Permalink
reworked release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerParkinson committed Nov 20, 2022
1 parent 3868537 commit 1b1b897
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,42 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v2
- name: Set up Maven Central Repository
uses: actions/setup-java@v3

uses: actions/setup-java@v1
with:
java-version: '17'
distribution: 'adopt'
java-version: 17
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Create Key File
run: echo "$GPG_PRIVATE_KEY" > private.key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Import GPG Key
run: gpg --import --batch private.key
- name: Cache
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- if: github.event.release
name: Update version in pom.xml (Release only)
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
- name: Run Maven
run: mvn -B clean install
- name: Publish package
run: mvn --batch-mode deploy
run: |-
mvn -B deploy -Dgpg.passphrase="$GPG_PASSPHRASE" -P release
env:
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}


# Examples are taken from
# - https://github.com/camunda/camunda-bpm-mockito/blob/465b4f5f2f29806a1a855e7cabf918b633df1075/.github/workflows/deploy.yml
# - https://github.com/see-es-vee/see-es-vee/blob/43bec4ef0005caa9b30cf11bf10efe03bd517733/.github/workflows/mavenpublish.yml

0 comments on commit 1b1b897

Please sign in to comment.