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
|
|
|
|
DEPLOYMENT_ARTIFACT_SELECTOR: SongodaCore-*.jar
|
|
|
|
|
|
|
|
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
|
|
|
|
uses: songoda/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 || '' }}
|
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
|
|
|
|
uses: songoda/GH-Commons/.github/actions/sign_jars@master
|
|
|
|
with:
|
|
|
|
jar_file_selector: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}/${{ env.DEPLOYMENT_ARTIFACT_SELECTOR }}
|
|
|
|
keystore_gpg_encrypted: ${{ secrets.JARSIGNER_KEYSTORE_ENCRYPTED }}
|
|
|
|
keystore_gpg_password: ${{ secrets.JARSIGNER_KEYSTORE_ENCRYPTED_PASSWORD }}
|
|
|
|
keystore_password: ${{ secrets.JARSIGNER_KEYSTORE_PASSWORD }}
|
|
|
|
|
|
|
|
- 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' }}
|
2022-08-07 19:33:38 +02:00
|
|
|
uses: songoda/GH-Commons/.github/actions/maven_deploy@master
|
|
|
|
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' }}
|
2022-08-07 19:33:38 +02:00
|
|
|
uses: songoda/GH-Commons/.github/actions/maven_deploy@master
|
|
|
|
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
|
|
|
|
uses: songoda/GH-Commons/.github/actions/discord_send_job_results@master
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2022-08-19 10:52:49 +02:00
|
|
|
webhook_url: ${{ secrets.DISCORD_BUILD_STATUS_WEBHOOK }}
|