Skip to content

Commit

Permalink
build: Update GH workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed May 31, 2024
1 parent 990e7ff commit e583159
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 74 deletions.
23 changes: 5 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2006-2022 the original author or authors.
# Copyright 2006-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@ on:
pull_request:

env:
JAVA_VERSION: '8'
JAVA_VERSION: '11'
JAVA_DISTRO: 'zulu'

jobs:
Expand All @@ -32,27 +32,14 @@ jobs:
if: startsWith(github.event.head_commit.message, 'Releasing version') != true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
cache: gradle

- name: Build
run: ./gradlew build -S
30 changes: 9 additions & 21 deletions .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2006-2022 the original author or authors.
# Copyright 2006-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@ on:
branches: [ master ]

env:
JAVA_VERSION: '8'
JAVA_VERSION: '11'
JAVA_DISTRO: 'zulu'

jobs:
Expand All @@ -33,33 +33,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: n1hility/cancel-previous-runs@v2
- name: Cancel previous run
uses: styfle/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
cache: gradle

- name: Build
run: ./gradlew -Prelease=true build -S
Expand All @@ -78,7 +66,7 @@ jobs:

- name: JReleaser output
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: artifact
path: |
Expand Down
50 changes: 16 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2006-2022 the original author or authors.
# Copyright 2006-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -26,7 +26,7 @@ on:
required: true

env:
JAVA_VERSION: '8'
JAVA_VERSION: '11'
JAVA_DISTRO: 'zulu'

jobs:
Expand All @@ -37,11 +37,12 @@ jobs:
VERSION: ${{ steps.vars.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: n1hility/cancel-previous-runs@v2
- name: Cancel previous run
uses: styfle/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Version
id: vars
Expand All @@ -54,29 +55,16 @@ jobs:
needs: [precheck]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
cache: gradle

- name: Set release version
run: |
Expand All @@ -89,20 +77,9 @@ jobs:
git commit -a -m "Releasing version $VERSION"
git push origin master
- name: Build
run: |
./gradlew -Prelease=true build -S
- name: Deploy
env:
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
./gradlew -Prelease=true -Pfull-release=true \
-PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \
-PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \
build publishToSonatype closeAndReleaseSonatypeStagingRepository -S
./gradlew -Pprofile=sbom -PreproducibleBuild=true publish -S
- name: Release
uses: jreleaser/release-action@v2
Expand All @@ -111,14 +88,19 @@ jobs:
env:
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
JRELEASER_TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
JRELEASER_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

- name: JReleaser output
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: artifact
path: |
Expand Down
2 changes: 1 addition & 1 deletion jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ deploy:

announce:
twitter:
active: release
active: RELEASE

0 comments on commit e583159

Please sign in to comment.