Skip to content

Bump actions/setup-java from 4.5.0 to 4.6.0 (#95) #43

Bump actions/setup-java from 4.5.0 to 4.6.0 (#95)

Bump actions/setup-java from 4.5.0 to 4.6.0 (#95) #43

Workflow file for this run

name: Test 🦂 Build 🧱 Release 🚰 and Publish 📦
on:
push:
branches:
- 'main'
paths-ignore:
- '**.md'
workflow_dispatch:
permissions: {}
defaults:
run:
shell: bash
working-directory: .
jobs:
test:
name: Test 🦂
permissions:
actions: read
contents: read
security-events: write
uses: ./.github/workflows/test.yaml
workflow-conditions:
name: 🛑🛑🛑 Stop builds that didn't change the release version 🛑🛑🛑
runs-on: ubuntu-latest
outputs:
version-file-changed: ${{ steps.version-file-check.outputs.version-file-changed }}
version-tag-exists: ${{ steps.version-tag-exists.outputs.version-tag-exists }}
steps:
- name: 🏁 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 2
- name: Check if version files changed
id: version-file-check
run: |
export VERSION_FILE="pom.xml"
[ "$(git diff HEAD^1.. --name-only | grep -e "^$VERSION_FILE$")" == "$VERSION_FILE" ] && echo "version-file-changed=${{toJSON(true)}}" >> $GITHUB_OUTPUT || echo "version-file-changed=${{toJSON(false)}}" >> $GITHUB_OUTPUT
- name: Notify on version-file-check
run: echo "::Notice::version-file-changed is ${{ fromJSON(steps.version-file-check.outputs.version-file-changed) }}"
- name: Check if version specified in version file has not released.
id: version-tag-exists
run: |
git fetch --tags
export VER=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
[ -z "$(git tag -l "java-v$VER")" ] && echo "version-tag-exists=${{toJSON(false)}}" >> $GITHUB_OUTPUT || echo "version-tag-exists=${{toJSON(true)}}" >> $GITHUB_OUTPUT
- name: Notify on version-tag-exists
run: echo "::Notice::version-tag-exists is ${{ fromJSON(steps.version-tag-exists.outputs.version-tag-exists) }}"
# Now any step that should only run on the version change can use
# "needs: [workflow-conditions]" Which will yield the condition checks below.
# We want to "release" automatically if "version-file-changed" is true on push
# Or manually if workflow_dispatch. BOTH need "version-tag-exists" is false.
build:
name: Build 🧱
needs: [test, workflow-conditions]
if: >-
${{ ((fromJSON(needs.workflow-conditions.outputs.version-file-changed) == true && github.event_name == 'push') ||
github.event_name == 'workflow_dispatch') && fromJSON(needs.workflow-conditions.outputs.version-tag-exists) == false }}
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: ☕🦆🌞 Set up Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: 'adopt'
java-version: '11'
architecture: x64
cache: maven
- name: 🏺 Build jar and source
run: make build_noninteractive
- name: 🆙 Upload jar
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: Package
path: target/*.jar
if-no-files-found: error
release:
name: Release 🚰
needs: [build]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 🆒 Download dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: Package
path: target
- name: 🚰 Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export VER=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
gh release create v$VER --generate-notes -t "Version $VER"
publish:
name: Publish 📦
needs: [release]
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: ☕🦆🌞 Set up Java; for publishing to Maven Central Repository
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
java-version: '11'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: 📦 Publish to the Maven Central Repository
run: make deploy_noninteractive_ossrh
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: ☕🦆🌞 Set up Java; for publishing to GitHub Packages
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
java-version: '11'
distribution: 'adopt'
server-id: github
- name: 📦 Publish to GitHub Packages
run: make deploy_noninteractive_github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docs:
name: Docs 📄
needs: [release, publish]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: ☕🦆🌞 Set up Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: 'adopt'
java-version: '11'
architecture: x64
cache: maven
- name: 📄 Docs
run: |
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
make docs_deploy SHORTSHA=$(git rev-parse --short HEAD) PASSWORD=$GITHUB_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}