2023-05-18 11:55:12 +02:00
|
|
|
name: Build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master, development ]
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
pull_request:
|
|
|
|
types: [ opened, synchronize, reopened ]
|
|
|
|
|
|
|
|
permissions: read-all
|
|
|
|
|
|
|
|
env:
|
2023-06-24 12:33:44 +02:00
|
|
|
DEPLOYMENT_POM_PATH: ./EpicAnchors-API/pom.xml
|
|
|
|
DEPLOYMENT_ARTIFACT_DIR: ./EpicAnchors-API/target
|
|
|
|
DEPLOYMENT_ARTIFACT_SELECTOR: EpicAnchors-API-*.jar
|
2023-06-24 12:44:46 +02:00
|
|
|
PLUGIN_ARTIFACT_DIR: ./EpicAnchors-Plugin/target
|
|
|
|
PLUGIN_ARTIFACT_SELECTOR: EpicAnchors-*.jar
|
2023-05-18 11:55:12 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
Build:
|
|
|
|
name: Build + Deploy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-11-01 15:45:51 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-05-18 11:55:12 +02:00
|
|
|
- name: Prepare Workspace
|
|
|
|
uses: craftaro/GH-Commons/.github/actions/setup_workspace@master
|
|
|
|
with:
|
2023-06-24 12:33:44 +02:00
|
|
|
maven_username: ${{ secrets.PLUGINS_MAVEN_REPO_USERNAME }}
|
|
|
|
maven_password: ${{ secrets.PLUGINS_MAVEN_REPO_PASSWORD }}
|
2023-05-18 11:55:12 +02:00
|
|
|
|
|
|
|
- name: Set project version
|
|
|
|
uses: craftaro/GH-Commons/.github/actions/maven_set_project_version@master
|
|
|
|
with:
|
|
|
|
append_snapshot: ${{ github.ref_type == 'tag' && 'false' || 'true' }}
|
|
|
|
version: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
|
|
|
|
increment_version: ${{ github.ref_type == 'tag' && '' || 'patch' }}
|
2023-06-24 12:33:44 +02:00
|
|
|
increment_version_only_if_not_snapshot_version: ${{ github.ref == 'refs/heads/development' && 'true' || 'false' }}
|
2023-05-18 11:55:12 +02:00
|
|
|
|
|
|
|
- name: Build with Maven
|
2023-06-24 12:33:44 +02:00
|
|
|
run: mvn -B -Duser.name="GitHub Actions on $GITHUB_REPOSITORY (id=$GITHUB_RUN_ID)" clean package
|
2023-05-18 11:55:12 +02:00
|
|
|
|
|
|
|
- name: Sign jar archives
|
|
|
|
uses: craftaro/GH-Commons/.github/actions/sign_jars@master
|
|
|
|
with:
|
|
|
|
jar_file_selector: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}/${{ env.DEPLOYMENT_ARTIFACT_SELECTOR }}
|
2023-06-24 12:33:44 +02:00
|
|
|
keystore_gpg_encrypted: ${{ secrets.PLUGINS_JARSIGNER_KEYSTORE_GPG }}
|
|
|
|
keystore_gpg_password: ${{ secrets.PLUGINS_JARSIGNER_KEYSTORE_GPG_PASSWORD }}
|
|
|
|
keystore_password: ${{ secrets.PLUGINS_JARSIGNER_KEYSTORE_PASSWORD }}
|
2023-05-18 11:55:12 +02:00
|
|
|
|
2023-06-24 12:44:46 +02:00
|
|
|
- name: Upload Build Artifacts [API]
|
2024-01-01 13:51:55 +01:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-05-18 11:55:12 +02:00
|
|
|
with:
|
2023-06-24 12:44:46 +02:00
|
|
|
name: ${{ github.event.repository.name }}-API
|
2023-05-18 11:55:12 +02:00
|
|
|
path: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}/${{ env.DEPLOYMENT_ARTIFACT_SELECTOR }}
|
|
|
|
|
2023-06-24 12:44:46 +02:00
|
|
|
- name: Upload Build Artifacts [Plugin]
|
2024-01-01 13:51:55 +01:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-06-24 12:44:46 +02:00
|
|
|
with:
|
|
|
|
name: ${{ github.event.repository.name }}
|
|
|
|
path: ${{ env.PLUGIN_ARTIFACT_DIR }}/${{ env.PLUGIN_ARTIFACT_SELECTOR }}
|
|
|
|
|
2023-06-24 12:33:44 +02:00
|
|
|
- name: Deploy to Maven repo
|
|
|
|
if: ${{ github.event_name == 'push' }}
|
|
|
|
uses: craftaro/GH-Commons/.github/actions/maven_deploy@master
|
|
|
|
with:
|
|
|
|
repository_url: ${{ vars.PLUGINS_MAVEN_REPO_URL_RELEASE }}
|
|
|
|
repository_url_snapshots: ${{ vars.PLUGINS_MAVEN_REPO_URL_SNAPSHOT }}
|
|
|
|
maven_pom_path: ${{ env.DEPLOYMENT_POM_PATH }}
|
|
|
|
maven_out_dir: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}
|
2023-06-24 12:44:46 +02:00
|
|
|
|
2023-06-24 12:33:44 +02:00
|
|
|
- name: Deploy parent pom.xml to Maven repo
|
|
|
|
if: ${{ github.event_name == 'push' }}
|
|
|
|
uses: craftaro/GH-Commons/.github/actions/maven_deploy@master
|
|
|
|
with:
|
|
|
|
repository_url: ${{ vars.PLUGINS_MAVEN_REPO_URL_RELEASE }}
|
|
|
|
repository_url_snapshots: ${{ vars.PLUGINS_MAVEN_REPO_URL_SNAPSHOT }}
|
|
|
|
only_deploy_pom: true
|
|
|
|
maven_out_dir: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}
|
2023-05-18 11:55:12 +02:00
|
|
|
|
|
|
|
discord_webhook:
|
|
|
|
name: Send Discord Webhook
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
needs: [ Build ]
|
|
|
|
if: ${{ always() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/development' || github.ref_type == 'tag') }}
|
|
|
|
|
|
|
|
steps:
|
2023-11-01 15:45:51 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-05-18 11:55:12 +02:00
|
|
|
- name: Notify Webhook
|
|
|
|
uses: craftaro/GH-Commons/.github/actions/discord_send_job_results@master
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
webhook_url: ${{ secrets.DISCORD_BUILD_STATUS_WEBHOOK }}
|