chore: updated build & deploy #194
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
# If this workflow is triggered by a push to master, it | |
# deploys a SNAPSHOT | |
# If this workflow is triggered by publishing a Release, it | |
# deploys a RELEASE with the selected version | |
# updates the project version by incrementing the patch version | |
# commits the version update change to the repository's default branch. | |
# This workflow waits for the `build` workflow to complete successfully before proceeding. | |
name: Deploy artifacts with Maven | |
on: | |
push: | |
branches: [master] | |
release: | |
types: [published] | |
jobs: | |
publish: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Wait for build to succeed | |
uses: fountainhead/action-wait-for-check@507b029e31edbe1a72d4de429476e1f4efe98869 # [email protected] | |
id: wait-for-build | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
checkName: build | |
ref: ${{ env.GITHUB_SHA || github.ref }} | |
- name: Cancel workflow when build fails | |
if: steps.wait-for-build.outputs.conclusion == 'failure' | |
run: echo "Build failed, skipping deploy" && exit 1 | |
- uses: actions/checkout@f0698e2cb784138d203b1caade48dca3d0fbdc53 # pin@v2 | |
- name: Detect release type | |
run: |- | |
if [[ "${{github.ref}}" == "refs/heads/master" ]]; then | |
echo "::set-output name=type::SNAPSHOT" | |
else | |
echo "::set-output name=type::RELEASE" | |
fi | |
id: release-detection | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up Java environment | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_SIGNING_KEY_SEC }} | |
gpg-passphrase: MAVEN_CENTRAL_GPG_PASSPHRASE | |
- name: Deploy SNAPSHOT / Release | |
# uses: camunda-community-hub/[email protected] | |
uses: ./.github/actions/action-maven-release | |
with: | |
release-version: ${{ github.event.release.tag_name }} | |
release-profile: community-action-maven-release | |
nexus-usr: ${{ secrets.NEXUS_USR }} | |
nexus-psw: ${{ secrets.NEXUS_PSW }} | |
maven-usr: ${{ secrets.MAVEN_CENTRAL_DEPLOYMENT_USR }} | |
maven-psw: ${{ secrets.MAVEN_CENTRAL_DEPLOYMENT_PSW }} | |
maven-gpg-passphrase: ${{ secrets.MAVEN_CENTRAL_GPG_SIGNING_KEY_PASSPHRASE }} | |
maven-auto-release-after-close: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
id: release | |
- if: github.event.release | |
name: Attach artifacts to GitHub Release (Release only) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ steps.release.outputs.artifacts_archive_path }} | |
asset_name: ${{ steps.release.outputs.artifacts_archive_path }} | |
asset_content_type: application/zip |