2022-08-07 19:33:38 +02:00
|
|
|
name: Build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-05-07 18:25:34 +02:00
|
|
|
branches: [ master, development ]
|
2022-08-07 19:33:38 +02:00
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
pull_request:
|
|
|
|
types: [ opened, synchronize, reopened ]
|
|
|
|
|
|
|
|
permissions: read-all
|
|
|
|
|
|
|
|
env:
|
|
|
|
DEPLOYMENT_POM_PATH: ./Core/dependency-reduced-pom.xml
|
|
|
|
DEPLOYMENT_ARTIFACT_DIR: ./Core/target
|
2023-06-11 00:41:05 +02:00
|
|
|
DEPLOYMENT_ARTIFACT_SELECTOR: CraftaroCore-*.jar
|
2022-08-07 19:33:38 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
Tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Prepare Workspace
|
|
|
|
uses: ./.github/actions/setup_project_workspace
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: mvn -B clean test
|
|
|
|
|
|
|
|
Build:
|
|
|
|
name: Build + Deploy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [ Tests ]
|
|
|
|
|
|
|
|
steps:
|
2023-05-07 18:40:23 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-08-07 19:33:38 +02:00
|
|
|
- name: Prepare Workspace
|
|
|
|
uses: ./.github/actions/setup_project_workspace
|
|
|
|
with:
|
2023-05-23 20:06:39 +02:00
|
|
|
maven_username: ${{ secrets.PLUGINS_MAVEN_REPO_USERNAME }}
|
|
|
|
maven_password: ${{ secrets.PLUGINS_MAVEN_REPO_PASSWORD }}
|
2022-08-07 19:33:38 +02:00
|
|
|
|
|
|
|
- name: Set project version
|
2023-06-11 00:41:05 +02:00
|
|
|
uses: craftaro/GH-Commons/.github/actions/maven_set_project_version@master
|
2022-08-07 19:33:38 +02:00
|
|
|
with:
|
|
|
|
append_snapshot: ${{ github.ref_type == 'tag' && 'false' || 'true' }}
|
|
|
|
version: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
|
2023-05-07 14:58:39 +02:00
|
|
|
increment_version: ${{ github.ref_type == 'tag' && '' || 'patch' }}
|
2022-08-07 19:33:38 +02:00
|
|
|
|
|
|
|
- name: Build with Maven
|
|
|
|
run: mvn -B -Duser.name="GitHub Actions on $GITHUB_REPOSITORY (id=$GITHUB_RUN_ID)" -DskipTests clean package
|
|
|
|
|
|
|
|
- name: Sign jar archives
|
2023-06-11 00:41:05 +02:00
|
|
|
uses: craftaro/GH-Commons/.github/actions/sign_jars@master
|
2022-08-07 19:33:38 +02:00
|
|
|
with:
|
|
|
|
jar_file_selector: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}/${{ env.DEPLOYMENT_ARTIFACT_SELECTOR }}
|
2023-05-23 20:49:30 +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 }}
|
2022-08-07 19:33:38 +02:00
|
|
|
|
|
|
|
- name: 'Upload Build Artifacts'
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: ${{ github.event.repository.name }}
|
|
|
|
path: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}/${{ env.DEPLOYMENT_ARTIFACT_SELECTOR }}
|
|
|
|
|
|
|
|
- name: Deploy to Maven repo
|
2023-05-07 18:25:00 +02:00
|
|
|
if: ${{ github.event_name == 'push' }}
|
2023-06-11 00:41:05 +02:00
|
|
|
uses: craftaro/GH-Commons/.github/actions/maven_deploy@master
|
2022-08-07 19:33:38 +02:00
|
|
|
with:
|
2023-05-23 20:06:39 +02:00
|
|
|
repository_url: ${{ vars.PLUGINS_MAVEN_REPO_URL_RELEASE }}
|
|
|
|
repository_url_snapshots: ${{ vars.PLUGINS_MAVEN_REPO_URL_SNAPSHOT }}
|
2022-08-07 19:33:38 +02:00
|
|
|
maven_pom_path: ${{ env.DEPLOYMENT_POM_PATH }}
|
|
|
|
maven_out_dir: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}
|
|
|
|
- name: Deploy parent pom.xml to Maven repo
|
2023-05-07 18:25:00 +02:00
|
|
|
if: ${{ github.event_name == 'push' }}
|
2023-06-11 00:41:05 +02:00
|
|
|
uses: craftaro/GH-Commons/.github/actions/maven_deploy@master
|
2022-08-07 19:33:38 +02:00
|
|
|
with:
|
2023-05-23 20:06:39 +02:00
|
|
|
repository_url: ${{ vars.PLUGINS_MAVEN_REPO_URL_RELEASE }}
|
|
|
|
repository_url_snapshots: ${{ vars.PLUGINS_MAVEN_REPO_URL_SNAPSHOT }}
|
2022-08-07 19:33:38 +02:00
|
|
|
only_deploy_pom: true
|
|
|
|
maven_out_dir: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}
|
|
|
|
|
|
|
|
discord_webhook:
|
|
|
|
name: Send Discord Webhook
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
needs: [ Tests, Build ]
|
|
|
|
if: ${{ always() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/development' || github.ref_type == 'tag') }}
|
|
|
|
|
|
|
|
steps:
|
2023-05-07 18:40:23 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-08-07 19:33:38 +02:00
|
|
|
- name: Notify Webhook
|
2023-06-11 00:41:05 +02:00
|
|
|
uses: craftaro/GH-Commons/.github/actions/discord_send_job_results@master
|
2022-08-07 19:33:38 +02:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2022-08-19 10:52:49 +02:00
|
|
|
webhook_url: ${{ secrets.DISCORD_BUILD_STATUS_WEBHOOK }}
|