Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 78 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,104 @@ on:
push:
pull_request_target:
types: [labeled]

env:
JAVA_VERSION: 25

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 25
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'
- name: Ensure to use tagged version
if: startsWith(github.ref, 'refs/tags/')
run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
- name: Build and Test
id: buildAndTest
run: mvn -B clean install
run: mvn -B verify --no-transfer-progress
- name: Attest
if: startsWith(github.ref, 'refs/tags/')
uses: actions/attest-build-provenance@v3
with:
subject-path: |
target/*.jar
target/*.pom
- uses: actions/upload-artifact@v4
with:
name: artifacts
path: target/*.jar

deploy-central:
name: Deploy to Maven Central
runs-on: ubuntu-latest
needs: [build]
if: github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]'))
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'
server-id: central
server-username: MAVEN_CENTRAL_USERNAME
server-password: MAVEN_CENTRAL_PASSWORD
- name: Verify project version matches tag
if: startsWith(github.ref, 'refs/tags/')
run: |
PROJECT_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)
test "$PROJECT_VERSION" = "$TAG_NAME"
env:
TAG_NAME: ${{ github.event.release.tag_name }}
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The github.event.release.tag_name will be null/empty when this workflow is triggered by a push event (the current trigger). The old publish-central.yml workflow was triggered by release events which made this context available. Since the workflow now triggers on push with tag checking via startsWith(github.ref, 'refs/tags/'), you should use ${GITHUB_REF##*/} instead or extract the tag name from github.ref directly, similar to how it's done in line 23.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in bbded71

- name: Deploy to Maven Central
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}

deploy-github:
name: Deploy to GitHub Packages
runs-on: ubuntu-latest
needs: [build]
if: github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]'))
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: temurin
cache: 'maven'
- name: Verify project version matches tag
if: startsWith(github.ref, 'refs/tags/')
run: |
PROJECT_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)
test "$PROJECT_VERSION" = "$TAG_NAME"
env:
TAG_NAME: ${{ github.event.release.tag_name }}
- name: Deploy to GitHub Packages
run: mvn deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}

release:
name: Release
runs-on: ubuntu-latest
needs: [deploy-central, deploy-github]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Create Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: true
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/publish-central.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/publish-github.yml

This file was deleted.