add log to check token #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy to sonatype | |
on: | |
push: | |
branches: [ release/** ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Import GPG key | |
env: | |
GPG_PRIVATE_KEY_BASE64: ${{ secrets.GPG_PRIVATE_KEY_BASE64 }} | |
run: | | |
echo "$GPG_PRIVATE_KEY_BASE64" | base64 --decode > private-key.asc | |
gpg --batch --import private-key.asc | |
echo "no-tty" >> ~/.gnupg/gpg.conf | |
echo "batch" >> ~/.gnupg/gpg.conf | |
- name: Set GPG key trust level | |
run: | | |
KEY_ID=$(gpg --list-keys --with-colons | awk -F: '/^pub/ { print $5 }') | |
echo -e "5\ny\n" | gpg --command-fd 0 --batch --yes --edit-key $KEY_ID trust | |
- name: Configure Maven for GPG | |
env: | |
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
CENTRAL_USERNAME: ${{ secrets.SONARTYPE_USERNAME }} | |
CENTRAL_PASSWORD: ${{ secrets.SONARTYPE_PASSWORD }} | |
run: | | |
mkdir -p $HOME/.m2 | |
echo "Central_Username is $CENTRAL_USERNAME" | |
echo "Central_Password is $CENTRAL_PASSWORD" | |
echo "Central_Username is ${{ secrets.SONARTYPE_USERNAME }}" | |
echo "Central_Password is ${{ secrets.SONARTYPE_PASSWORD }}" | |
echo "<settings> | |
<servers> | |
<server> | |
<id>central</id> | |
<username>$CENTRAL_USERNAME</username> | |
<password>$CENTRAL_PASSWORD</password> | |
</server> | |
<server> | |
<id>gpg.passphrase</id> | |
<passphrase>$GPG_PASSPHRASE</passphrase> | |
</server> | |
</servers> | |
<profiles> | |
<profile> | |
<id>gpg</id> | |
<properties> | |
<gpg.executable>gpg</gpg.executable> | |
<gpg.keyname>$GPG_KEY_NAME</gpg.keyname> | |
<gpg.passphraseServerId>$GPG_PASSPHRASE</gpg.passphraseServerId> | |
</properties> | |
</profile> | |
</profiles> | |
<activeProfiles> | |
<activeProfile>gpg</activeProfile> | |
</activeProfiles> | |
</settings>" > $HOME/.m2/settings-security.xml | |
- name: Build with Maven and sign artifacts | |
env: | |
GPG_TTY: $(tty) | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} | |
working-directory: Hoodies-Network | |
run: | | |
export GPG_TTY=$(tty) | |
mvn clean deploy --settings $HOME/.m2/settings-security.xml |