Release a new version #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on: | |
# - https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# - https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-maven | |
name: Release a new version | |
on: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: 'Release version' | |
required: true | |
default: '0.1.0-SNAPSHOT' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Maven Central Repository | |
uses: actions/setup-java@v3 | |
with: | |
cache: maven | |
java-version: '11' | |
distribution: 'temurin' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Update POM version | |
run: mvn -B -ntp -Dgpg.skip versions:set "-DnewVersion=${{ github.event.inputs.release_version }}" -DgenerateBackupPoms=false | |
- name: Package | |
run: mvn -B -ntp -Dgpg.skip package | |
- name: Deploy to OSSRH | |
run: mvn -B -ntp clean deploy -DskipTests=true | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }} | |
- name: Generate changelog | |
id: changelog | |
uses: metcalfc/[email protected] | |
with: | |
myToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.release_version }} | |
release_name: ${{ github.event.inputs.release_version }} | |
body: | | |
``` | |
<dependencies> | |
<dependency> | |
<groupId>com.saucelabs</groupId> | |
<artifactId>ci-sauce</artifactId> | |
<version>${{ github.event.inputs.release_version }}</version> | |
</dependency> | |
</dependencies> | |
``` | |
### Changelog | |
${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false |