Skip to content

4.0.0.4121

4.0.0.4121 #29

Workflow file for this run

name: Release
# This workflow is triggered when publishing a GitHub release
on:
release:
types:
- published
jobs:
release:
permissions:
id-token: write
contents: write
uses: SonarSource/gh-action_release/.github/workflows/main.yaml@v5
with:
publishToBinaries: true
mavenCentralSync: true
slackChannel: team-lang-java-notifs
relocation-pom:
name: Publish relocation POM
runs-on: ubuntu-latest
needs:
- release
permissions:
id-token: write
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Get secrets
id: secrets
uses: SonarSource/vault-action-wrapper@8e22afd670393ed80f489f5dbd517d09ea21d75b
with:
secrets: |
development/kv/data/slack webhook | slack_webhook;
development/kv/data/ossrh username | ossrh_username;
development/kv/data/ossrh password | ossrh_password;
development/kv/data/sign key | sign_key;
development/kv/data/sign passphrase | sign_passphrase;
- name: Prepare repo for uploading
working-directory: relocation/
run: |
GROUP_ID=$(mvn --batch-mode org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression="project.groupId" -q -DforceStdout)
ARTIFACT_ID=$(mvn --batch-mode org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression="project.artifactId" -q -DforceStdout)
_PATH="local_repo/${GROUP_ID//.//}/${ARTIFACT_ID}/${{ github.event.release.tag_name }}"
POM_PATH="${_PATH}/${ARTIFACT_ID}-${{ github.event.release.tag_name }}.pom"
mkdir --parent "${_PATH}"
sed 's|REPLACE_ME|${{ github.event.release.tag_name }}|' pom.xml > "${POM_PATH}"
md5sum "${POM_PATH}" | cut -d\ -f1 > "${POM_PATH}.md5"
sha1sum "${POM_PATH}" | cut -d\ -f1 > "${POM_PATH}.sha1"
sha256sum "${POM_PATH}" | cut -d\ -f1 > "${POM_PATH}.sha256"
sha512sum "${POM_PATH}" | cut -d\ -f1 > "${POM_PATH}.sha512"
export GNUPGHOMEDIR=gnupg/
mkdir --parent "${GNUPGHOMEDIR}"
echo "${GPG_PRIVATE_KEY_PASSPHRASE}" | gpg --batch --pinentry-mode loopback --passphrase-fd 0 --quiet --import <(echo "${GPG_PRIVATE_KEY_BASE64}")
echo "${GPG_PRIVATE_KEY_PASSPHRASE}" | gpg --batch --pinentry-mode loopback --passphrase-fd 0 --quiet --detach-sign --armor "${POM_PATH}"
rm -rf "${GNUPGHOMEDIR}"
env:
GPG_PRIVATE_KEY_BASE64: ${{ fromJSON(steps.secrets.outputs.vault).sign_key }}
GPG_PRIVATE_KEY_PASSPHRASE: ${{ fromJSON(steps.secrets.outputs.vault).sign_passphrase }}
- name: Maven Central Sync
id: maven-central-sync
uses: SonarSource/gh-action_release/maven-central-sync@v5
with:
local-repo-dir: relocation/local_repo/
nexus-url: https://oss.sonatype.org/
staging-profile-id: 23a95768f56d42
env:
OSSRH_USERNAME: ${{ fromJSON(steps.secrets.outputs.vault).ossrh_username }}
OSSRH_PASSWORD: ${{ fromJSON(steps.secrets.outputs.vault).ossrh_password }}
- name: Notify on failure
if: failure()
uses: 8398a7/action-slack@v3
with:
channel: team-lang-java-notifs
status: failure
fields: repo,author,eventName
env:
SLACK_WEBHOOK_URL: ${{ fromJSON(steps.secrets.outputs.vault).slack_webhook }}