Skip to content

Commit 9e62394

Browse files
Adicionado action deploy
1 parent caf80aa commit 9e62394

File tree

2 files changed

+105
-1
lines changed

2 files changed

+105
-1
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Liberar nova versão Maven
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
release:
13+
name: Build, Test and Release
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Setup Java 8
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: '8'
27+
distribution: 'temurin'
28+
cache: maven
29+
30+
- name: Set release version
31+
run: |
32+
VERSION="${{ github.event.inputs.version }}"
33+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
34+
mvn versions:set -DnewVersion=$VERSION
35+
mvn versions:commit
36+
37+
- name: Build and test with Java 8
38+
run: |
39+
mvn clean compile test -B
40+
41+
- name: Setup Maven settings.xml
42+
run: |
43+
mkdir -p ~/.m2
44+
cat > ~/.m2/settings.xml << 'EOF'
45+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
46+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
47+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
48+
<servers>
49+
<server>
50+
<id>central</id>
51+
<username>${{ secrets.MAVEN_CENTRAL_USERNAME }}</username>
52+
<password>${{ secrets.MAVEN_CENTRAL_PASSWORD }}</password>
53+
</server>
54+
</servers>
55+
</settings>
56+
EOF
57+
58+
- name: Setup GPG
59+
env:
60+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
61+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
62+
run: |
63+
# Import GPG key
64+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
65+
66+
# Configure GPG for non-interactive mode
67+
echo "use-agent" >> ~/.gnupg/gpg.conf
68+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
69+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
70+
71+
# Restart GPG agent
72+
gpgconf --kill gpg-agent || true
73+
gpgconf --launch gpg-agent
74+
75+
# Get the key ID and verify it's the correct one
76+
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep "1F93637480018AD7" | head -1 | awk '{print $2}' | cut -d'/' -f2)
77+
echo "GPG_KEY_ID=$GPG_KEY_ID" >> $GITHUB_ENV
78+
echo "Using GPG Key ID: $GPG_KEY_ID"
79+
80+
# Test signing
81+
echo "test signing" | gpg --clearsign --armor --pinentry-mode loopback --batch --passphrase "$GPG_PASSPHRASE" --default-key "1F93637480018AD7"
82+
83+
- name: Deploy to Maven Central Portal
84+
env:
85+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
86+
run: |
87+
export GPG_TTY=$(tty)
88+
git config user.name "github-actions[bot]"
89+
git config user.email "github-actions[bot]@users.noreply.github.com"
90+
mvn deploy -B --no-transfer-progress
91+
92+
- name: Create GitHub Release
93+
if: success()
94+
uses: softprops/action-gh-release@v2
95+
with:
96+
tag_name: v${{ env.RELEASE_VERSION }}
97+
name: Release v${{ env.RELEASE_VERSION }}
98+
body_path: CHANGELOG.md
99+
draft: false
100+
prerelease: false
101+
files: |
102+
target/paf-nfce-${{ env.RELEASE_VERSION }}.jar
103+
target/paf-nfce-${{ env.RELEASE_VERSION }}-sources.jar
104+
target/paf-nfce-${{ env.RELEASE_VERSION }}-javadoc.jar

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010

1111
package:
12-
runs-on: ubuntu-24.04
12+
runs-on: ubuntu-latest
1313
name: Empacotar executavel
1414
steps:
1515
- uses: actions/checkout@v2

0 commit comments

Comments
 (0)