mirror of
https://github.com/songoda/EpicAnchors.git
synced 2024-10-31 23:59:35 +01:00
8e5cb2405d
We have a new template for compiling projects and publishing them but it hasn't really been designed with API modules in mind yet and needs some smaler adjustments before being used in all projects. I don't want to manually update all projects if I change the template workflow file.
78 lines
2.8 KiB
YAML
78 lines
2.8 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [ master, development ]
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
types: [ opened, synchronize, reopened ]
|
|
|
|
permissions: read-all
|
|
|
|
env:
|
|
DEPLOYMENT_POM_PATH: ./dependency-reduced-pom.xml
|
|
DEPLOYMENT_ARTIFACT_DIR: ./target
|
|
DEPLOYMENT_ARTIFACT_SELECTOR: EpicAnchors-*.jar
|
|
|
|
jobs:
|
|
Build:
|
|
name: Build + Deploy
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Prepare Workspace
|
|
uses: craftaro/GH-Commons/.github/actions/setup_workspace@master
|
|
with:
|
|
maven_username: ${{ secrets.MAVEN_REPO_USERNAME }}
|
|
maven_password: ${{ secrets.MAVEN_REPO_PASSWORD }}
|
|
|
|
- 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' }}
|
|
|
|
- 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: craftaro/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
|
|
# if: ${{ github.event_name == 'push' }}
|
|
# uses: craftaro/GH-Commons/.github/actions/maven_deploy@master
|
|
# with:
|
|
# repository_url: ${{ secrets.MAVEN_REPO_URL_RELEASES }}
|
|
# repository_url_snapshots: ${{ secrets.MAVEN_REPO_URL_SNAPSHOTS }}
|
|
# maven_pom_path: ${{ env.DEPLOYMENT_POM_PATH }}
|
|
# maven_out_dir: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}
|
|
|
|
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:
|
|
- uses: actions/checkout@v3
|
|
- 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 }}
|