Skip to content

Commit

Permalink
Adjust GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Jan 3, 2022
1 parent 57b531a commit 4bc6b4d
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, '🏁 Releasing version') != true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: "Release version"
required: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: 'Set up Java'
uses: actions/setup-java@v2
with:
java-version: 17
distribution: 'zulu'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: 'Cache Maven packages'
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Update version
id: version
run: |
VERSION=${{ github.event.inputs.version }}
echo "Updating POMs to version $VERSION"
./mvnw -B versions:set versions:commit -DnewVersion=$VERSION
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -a -m "🏁 Releasing version $VERSION"
git push origin HEAD:master
- name: Release to Maven Central
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
export GPG_TTY=$(tty)
./mvnw --no-transfer-progress -B --file pom.xml \
-Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git \
-Dmaven.site.skip=true -Drelease=true deploy
- name: Release to GitHub
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./mvnw -B --file pom.xml -Prelease -pl :unitfx-parent jreleaser:full-release

- name: JReleaser output
if: always()
uses: actions/upload-artifact@v2
with:
name: jreleaser-logs
path: |
target/jreleaser/trace.log
target/jreleaser/output.properties

0 comments on commit 4bc6b4d

Please sign in to comment.