SongodaCore/.github/workflows/build.yml
dependabot[bot] 20a10c3551
Bump actions/checkout from 3 to 4 (#69)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-01 22:15:43 +02:00

98 lines
3.6 KiB
YAML

name: Build
on:
push:
branches: [ master, development ]
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: CraftaroCore-*.jar
jobs:
Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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:
- uses: actions/checkout@v4
- name: Prepare Workspace
uses: ./.github/actions/setup_project_workspace
with:
maven_username: ${{ secrets.PLUGINS_MAVEN_REPO_USERNAME }}
maven_password: ${{ secrets.PLUGINS_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' }}
increment_version_only_if_not_snapshot_version: ${{ github.ref == 'refs/heads/development' && 'true' || 'false' }}
- 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.PLUGINS_JARSIGNER_KEYSTORE_GPG }}
keystore_gpg_password: ${{ secrets.PLUGINS_JARSIGNER_KEYSTORE_GPG_PASSWORD }}
keystore_password: ${{ secrets.PLUGINS_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: ${{ 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 }}
- 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 }}
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:
- uses: actions/checkout@v4
- 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 }}