Skip to content

Commit 8fcfde5

Browse files
authored
fix
1 parent d220e33 commit 8fcfde5

File tree

2 files changed

+58
-55
lines changed

2 files changed

+58
-55
lines changed

.github/workflows/pipeline.yml

+57-54
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,27 @@ on:
88

99
jobs:
1010
bump:
11-
name: Get And Bump SemVer 👊
12-
runs-on: ubuntu-latest
13-
outputs:
14-
pom_version: ${{ steps.set_version.outputs.pom_version }}
15-
major_version: ${{ steps.set_version.outputs.major_version }}
16-
minor_version: ${{ steps.set_version.outputs.minor_version }}
17-
build_version: ${{ steps.set_version.outputs.build_version }}
18-
steps:
19-
- name: Checkout repo 📦
20-
uses: actions/checkout@v4
21-
with:
22-
fetch-depth: '0'
23-
- name: Bump version and push tag 👊
24-
uses: anothrNick/github-tag-action@master
25-
id: bump_version
26-
env:
27-
GITHUB_TOKEN: ${{ github.TOKEN }}
28-
RELEASE_BRANCHES: master
29-
DEFAULT_BUMP: patch
30-
WITH_V: false
31-
- name: Extract version from tag 🔍
32-
id: set_version
33-
env:
34-
POM_VERSION: ${{ steps.bump_version.outputs.new_tag }}
35-
run: |
36-
MAJOR_VERSION=$(echo $POM_VERSION | cut -d. -f1)
37-
MINOR_VERSION=$(echo $POM_VERSION | cut -d. -f2)
38-
BUILD_VERSION=$(echo $POM_VERSION | cut -d. -f3)
39-
echo POM:$POM_VERSION, MAJOR:$MAJOR_VERSION, MINOR:$MINOR_VERSION, BUILD:$BUILD_VERSION
40-
echo --- set output for step ---
41-
echo "pom_version=${POM_VERSION}" >> $GITHUB_ENV
42-
echo "major_version=${MAJOR_VERSION}" >> $GITHUB_ENV
43-
echo "minor_version=${MINOR_VERSION}" >> $GITHUB_ENV
44-
echo "build_version=${BUILD_VERSION}" >> $GITHUB_ENV
45-
echo --- set output for job ---
46-
echo "pom_version=${POM_VERSION}" >> $GITHUB_OUTPUT
47-
echo "major_version=${MAJOR_VERSION}" >> $GITHUB_OUTPUT
48-
echo "minor_version=${MINOR_VERSION}" >> $GITHUB_OUTPUT
49-
echo "build_version=${BUILD_VERSION}" >> $GITHUB_OUTPUT
11+
uses: UnterrainerInformatik/bump-semver-workflow/.github/workflows/workflow.yml@master
5012
build:
5113
name: Build and publish to Maven Central 🔨
52-
runs-on: ubuntu-latest
14+
runs-on: [self-hosted, Linux, X64]
5315
env:
16+
MAVEN_PROFILES: release-to-sonatype
5417
MAVEN_ARGS: -Dmaven.test.skip=true
55-
outputs:
56-
pom_version: ${{ needs.bump.outputs.pom_version }}
57-
major_version: ${{ needs.bump.outputs.major_version }}
58-
minor_version: ${{ needs.bump.outputs.minor_version }}
59-
build_version: ${{ needs.bump.outputs.build_version }}
6018
needs: [bump]
6119
steps:
20+
- name: Pre-fetch upload-artifact action (self-hosted only) ⚙️
21+
if: contains(runner.labels, 'self-hosted')
22+
run: |
23+
mkdir -p ~/.setup-actions
24+
cd ~/.setup-actions
25+
if [ ! -d "upload-artifact" ]; then
26+
echo "Cloning upload-artifact@v4..."
27+
git clone --depth=1 --branch v4 https://github.com/actions/upload-artifact.git upload-artifact
28+
echo "✅ upload-artifact@v4 cloned manually!"
29+
else
30+
echo "✅ upload-artifact already fetched."
31+
fi
6232
- name: Checkout repo 📦
6333
uses: actions/checkout@v4
6434
- name: Cache Maven packages 💾
@@ -75,25 +45,58 @@ jobs:
7545
server-id: maven
7646
server-username: ${{ secrets.SONATYPE_USERNAME }}
7747
server-password: ${{ secrets.SONATYPE_PASSWORD }}
78-
- name: Import GPG key using gpg2 🔐
48+
- name: Set up GPG for CI 🔐
7949
run: |
50+
which gpg2 || sudo apt update && sudo apt install -y gnupg2
51+
mkdir -p ~/.gnupg
52+
chmod 700 ~/.gnupg
53+
echo "use-agent" >> ~/.gnupg/gpg.conf
54+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
55+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
56+
echo "default-cache-ttl 600" >> ~/.gnupg/gpg-agent.conf
57+
echo "max-cache-ttl 7200" >> ~/.gnupg/gpg-agent.conf
58+
gpgconf --kill gpg-agent
59+
gpgconf --launch gpg-agent
8060
echo "${{ secrets.GPG_SECRET_KEY }}" | base64 --decode | gpg2 --batch --yes --import
8161
echo "${{ secrets.GPG_OWNERTRUST }}" | base64 --decode | gpg2 --import-ownertrust
8262
export GPG_TTY=$(tty)
83-
export GPG_EXECUTABLE=gpg2
63+
- name: Write .m2/settings.xml 💾
64+
run: |
65+
mkdir -p ~/.m2
66+
cat <<EOF > ~/.m2/settings.xml
67+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
68+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
69+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
70+
<servers>
71+
<server>
72+
<id>maven</id>
73+
<username>${{ secrets.SONATYPE_USERNAME }}</username>
74+
<password>${{ secrets.SONATYPE_PASSWORD }}</password>
75+
</server>
76+
</servers>
77+
</settings>
78+
EOF
79+
- name: Conditionally setup Maven ⚙️
80+
run: |
81+
wihch mvn || (sudo apt update && sudo apt install -y maven)
8482
- name: Update pom.xml version 💾
8583
run: |
8684
mvn versions:set -DnewVersion=${{ needs.bump.outputs.major_version }}.${{ needs.bump.outputs.minor_version }}.${{ needs.bump.outputs.build_version }} -DgenerateBackupPoms=false
87-
- name: Build and verify with Maven 🔨
88-
run: mvn --batch-mode --update-snapshots verify $MAVEN_ARGS
89-
- name: Publish to Maven Central
90-
run: mvn deploy $MAVEN_ARGS
85+
- name: Build and publish with Maven 🔨
9186
env:
92-
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
93-
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
94-
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.GPG_SECRET_KEY }}
9587
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
88+
run: mvn clean deploy --batch-mode --update-snapshots -P${{ env.MAVEN_PROFILES }} $MAVEN_ARGS
89+
- name: List signed files 🐞
90+
run: |
91+
echo "📦 Contents of target/:"
92+
ls -lh target/
93+
echo ""
94+
echo "🔍 GPG signatures:"
95+
find target/ -type f -name "*.asc" -exec echo "✔ Found:" {} \;
96+
echo ""
97+
echo "❓ Missing POM signature?" && test ! -f target/*pom.asc && echo "❌ No POM signature found!" || echo "✅ POM is signed."
9698
- name: Upload build artifacts ⬆️
99+
if: ${{ always() && hashFiles('target/*.jar') != '' }}
97100
uses: actions/upload-artifact@v4
98101
with:
99102
name: maven-artifacts

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>info.unterrainer.commons</groupId>
55
<artifactId>parent-pom</artifactId>
6-
<version>0.2.5</version>
6+
<version>0.2.27</version>
77
</parent>
88

99
<modelVersion>4.0.0</modelVersion>

0 commit comments

Comments
 (0)