Skip to content

Commit

Permalink
build: Upddate GH workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed May 31, 2024
1 parent 993e5fd commit 9745658
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 49 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# 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.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Build

on:
pull_request:

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

jobs:
build:
name: Build
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, 'Releasing version') != true

steps:
- uses: actions/checkout@v4

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

- name: Build
run: ./gradlew build -S
77 changes: 77 additions & 0 deletions .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# 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.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: EarlyAccess

on:
push:
branches: [ master ]

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

jobs:
earlyaccess:
name: EarlyAccess
if: github.repository == 'kordamp/ezmorph' && startsWith(github.event.head_commit.message, 'Releasing version') != true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cancel previous run
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

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

- name: Build
run: ./gradlew -Prelease=true build -S

- name: Version
id: vars
run: echo ::set-output name=version::$(cat VERSION)

- name: Release
uses: jreleaser/release-action@v2
with:
arguments: release
env:
JRELEASER_PROJECT_VERSION: ${{ steps.vars.outputs.version }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}

- name: JReleaser output
if: always()
uses: actions/upload-artifact@v4
with:
name: artifact
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
49 changes: 0 additions & 49 deletions .github/workflows/gradle.yml

This file was deleted.

108 changes: 108 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# 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.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Release

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

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

jobs:
precheck:
name: Precheck
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.vars.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cancel previous run
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Version
id: vars
shell: bash
run: |
echo ::set-output name=VERSION::${{ github.event.inputs.version }}
release:
name: Release
needs: [precheck]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Set release version
run: |
VERSION=${{ github.event.inputs.version }}
echo $VERSION > VERSION
git add VERSION
sed -i -e "s/^\:project-version\:\ .*/:project-version: ${{ needs.precheck.outputs.VERSION }}/g" README.adoc
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 master
- name: Deploy
run: |
./gradlew -Pprofile=sbom -PreproducibleBuild=true publish -S
- name: Release
uses: jreleaser/release-action@v2
with:
arguments: full-release
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@v4
with:
name: artifact
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties

0 comments on commit 9745658

Please sign in to comment.