Skip to content

feat: force support of jvm 8, but build in jvm 21 for gradle #87

feat: force support of jvm 8, but build in jvm 21 for gradle

feat: force support of jvm 8, but build in jvm 21 for gradle #87

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Parsek Release
on:
push:
branches: [ "alpha", "beta", "main" ]
permissions:
contents: read
jobs:
get-next-version:
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Install Semantic Release & Plugins
run: |
npm install --no-save semantic-release @semantic-release/changelog
- name: Dry run to get next release version
id: get-next-version
run: |
# Get the full output of semantic-release dry-run
SEMANTIC_OUTPUT=$(npx semantic-release --dry-run)
# Extract the next release version
NEXT_TAG_VERSION=$(echo "$SEMANTIC_OUTPUT" | grep 'next release version is ' | awk -F"next release version is " '{print $2}')
# Export version to GITHUB_OUTPUT if needed
echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
- name: Echo new_tag_version
run: |
echo "Extracted Tag Version: ${{ steps.get-next-version.outputs.new_tag_version }}"
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
outputs:
new_tag_version: ${{ steps.get-next-version.outputs.new_tag_version }}
build-and-release:
runs-on: ubuntu-latest
needs: get-next-version
if: ${{needs.get-next-version.outputs.new_tag_version != ''}}
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v4
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Get Time
id: time
uses: nanzm/[email protected]
with:
timeZone: 8
format: 'YYYYMMDDHHmmss'
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v4
- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
echo "$GPG_PASSPHRASE" | gpg --batch --pinentry-mode loopback --passphrase-fd 0 --import-ownertrust
- name: Build & Publish
run: |
./gradlew ${{ steps.extract_branch.outputs.branch == 'main' && 'build' || 'buildDev' }} publish \
-PbuildType=${{ steps.extract_branch.outputs.branch == 'main' && 'release' || steps.extract_branch.outputs.branch }} \
-Pversion=${{ needs.get-next-version.outputs.new_tag_version }} \
-PtimeStamp=${{ steps.time.outputs.time }}
env:
USERNAME_GITHUB: ${{ secrets.USERNAME_GITHUB }}
TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Install Semantic Release & Plugins
run: |
npm install --no-save semantic-release @semantic-release/changelog
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
run: npx semantic-release