diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 94ad0a3e2..3c90ed9a6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,54 +9,38 @@ on: env: BRANCH_NAME: ${{github.ref_name}} - IS_TAG: ${{contains(github.ref_type, 'tag')}} jobs: + pr-verification: + name: Pull Request Validation + runs-on: ubuntu-24.04 + if: github.event_name == 'pull_request' + steps: + - name: Pull Request Version Validation + uses: ikmdev/maven-pull-request-version-validation-action@v1.0.0 + build-job: name: Build Job runs-on: ubuntu-24.04 - outputs: - RELEASE_UPLOAD_URL: ${{steps.upload_url.outputs.RELEASE_UPLOAD_URL}} steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: java-version: '21' distribution: 'zulu' - + - name: Build IKMDEV Code - uses: ikmdev/maven-clean-install-build-action@v1.1.0 + uses: ikmdev/maven-clean-install-build-action@v2.0.0 with: branch_name: ${{env.BRANCH_NAME}} - sonarcloud_token: ${{ secrets.SONAR_TOKEN }} - sonarcloud_host_url: ${{ 'https://sonarcloud.io/'}} - sonarcloud_organization: ${{ github.repository_owner }} - sonarcloud_sources: ${{ 'src/main/java' }} - sonarcloud_projectKey: ${{ github.repository_owner }}_${{ github.event.repository.name }} - sonarcloud_coverage_jacoco_xmlReportPaths: ${{ 'target/site/jacoco/jacoco.xml' }} - sonarcloud_java_binaries: ${{ 'target/classes' }} - sonarcloud_tests: ${{ '' }} - - - - name: Get Release URL (Tag) - id: get_tag_release_url - if: env.IS_TAG == 'true' - uses: octokit/request-action@v2.x - with: - route: GET /repos/${{github.repository}}/releases/tags/${{env.BRANCH_NAME}} - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - - - name: Print & Assign Release Upload Url (Tag) - if: env.IS_TAG == 'true' - id: upload_url - run: | - echo "RELEASE_UPLOAD_URL=${{fromJson(steps.get_tag_release_url.outputs.data).upload_url}}" >> $GITHUB_OUTPUT generate_build_installers: - name: Generate Release Installers + name: Generate Snapshot Installers needs: build-job + if: ${{!contains(github.ref_type, 'tag')}} strategy: matrix: os: [macos-13, macos-14, ubuntu-20.04, windows-2022] @@ -75,9 +59,8 @@ jobs: uses: ./.github/installer_composite with: branch_name: ${{ env.BRANCH_NAME }} - isTag: ${{env.IS_TAG}} - release_upload_url: ${{ needs.build-job.outputs.RELEASE_UPLOAD_URL || '' }} + isTag: "false" + release_upload_url: ${{ '' }} github_token: ${{secrets.GITHUB_TOKEN}} operating_system: ${{matrix.os}} - - + \ No newline at end of file diff --git a/.github/workflows/post_build.yaml b/.github/workflows/post_build.yaml new file mode 100644 index 000000000..19f991081 --- /dev/null +++ b/.github/workflows/post_build.yaml @@ -0,0 +1,73 @@ +name: Post Build Action Workflow + +run-name: 'Post Build Action -- ${{github.event.workflow_run.head_branch}}' + +on: + workflow_run: + workflows: + - Build Workflow + types: + - completed + +permissions: + contents: write + +jobs: + post-build: + name: Post Build Actions + runs-on: ubuntu-24.04 + if: github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'ikmdev' + outputs: + RELEASE_UPLOAD_URL: ${{steps.ikmdev_post_build.outputs.release_upload_url}} + IS_TAG: ${{steps.ikmdev_post_build.outputs.is_tag}} + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + repository: ${{github.event.workflow_run.head_repository.full_name}} + ref: ${{github.event.workflow_run.head_branch}} + fetch-depth: 0 + + - name: IKMDEV Post Build Action + id: ikmdev_post_build + uses: ikmdev/maven-post-build-action@v1.0.0 + with: + nexus_repo_password: ${{secrets.EC2_NEXUS_PASSWORD}} + branch_name: ${{github.event.workflow_run.head_branch}} + github_token: ${{secrets.GITHUB_TOKEN}} + ossrh_username: ${{secrets.OSSRH_TOKEN_USER}} + ossrh_token: ${{secrets.OSSRH_TOKEN_PASS}} + gpg_key: ${{secrets.GPG_KEY}} + gpg_passphrase: ${{secrets.GPG_PASSPHRASE}} + sonarcloud_token: ${{ secrets.SONAR_TOKEN }} + sonarcloud_tests: ${{ '' }} + + generate_release_installers: + name: Generate Release Installers + needs: post-build + if: needs.post-build.outputs.IS_TAG == 'true' + strategy: + matrix: + os: [macos-13, macos-14, ubuntu-20.04, windows-2022] + runs-on: ${{matrix.os}} + steps: + - name: Checkout Code Repository + uses: actions/checkout@v4 + with: + ref: ${{github.event.workflow_run.head_branch}} + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '21' + + - name: Composite Action + uses: ./.github/installer_composite + with: + branch_name: ${{github.event.workflow_run.head_branch}} + isTag: "true" + release_upload_url: ${{ needs.post-build.outputs.RELEASE_UPLOAD_URL}} + github_token: ${{secrets.GITHUB_TOKEN}} + operating_system: ${{matrix.os}} + diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index cb631b3fb..000000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Publish Artifacts Workflow - -run-name: 'Publish Artifacts To Nexus -- ${{github.event.workflow_run.head_branch}}' - -on: - workflow_run: - workflows: - - Build Workflow - types: - - completed - - -jobs: - publish-artifacts: - name: Publish Artifacts - runs-on: ubuntu-24.04 - if: github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'ikmdev' - steps: - - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'zulu' - - - - name: Deploy Artifacts To Nexus - uses: ikmdev/maven-nexus-deploy-action@v1.1.0 - with: - nexus_repo_password: ${{secrets.EC2_NEXUS_PASSWORD}} - repo_name: ${{github.event.workflow_run.head_repository.full_name}} - branch_name: ${{github.event.workflow_run.head_branch}} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4c184cca4..ebde7bb97 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,14 +1,29 @@ -name: Release Workflow + +name: SemVer Release Workflow run-name: "Releasing ${{ github.event.repository.name }} #${{github.run_number}}" # Trigger workflow manually on: workflow_dispatch: + inputs: + release_version: + type: string + description: "(Optional) Custom Release Version" + required: false + version_type: + description: 'Development version type to increment' + required: true + default: 'minor' + type: choice + options: + - major + - minor + - patch env: - BRANCH_NAME: ${{github.ref_name}} - TRUNK_BRANCH_NAME: 'main' + BRANCH_NAME: ${{ github.ref_name }} + TRUNK_BRANCH_NAME: ${{ github.event.repository.default_branch }} jobs: release: @@ -19,17 +34,17 @@ jobs: - name: Verify Branch if: env.BRANCH_NAME != env.TRUNK_BRANCH_NAME run: | - echo "ERROR: Attempting to release from branch ${{env.BRANCH_NAME}}. Release from ${{env.TRUNK_BRANCH_NAME}} branch only" + echo "ERROR: Attempting to release from branch ${{ env.BRANCH_NAME }}. Release from ${{ env.TRUNK_BRANCH_NAME }} branch only." exit 1 - - name: Release IKMDEV Code - id: release_ikmdev_codes - uses: ikmdev/maven-release-action@v1.1.0 + - name: Checkout Repository + uses: actions/checkout@v4 + with: + token: ${{secrets.IKMDEVOPS_PAT_TOKEN}} + + - name: Shared Release Action + uses: ikmdev/maven-semver-release-action@v1.0.0 with: - ikmdevops_pat: ${{secrets.IKMDEVOPS_PAT_TOKEN}} + version_type: ${{ github.event.inputs.version_type }} github_token: ${{secrets.GITHUB_TOKEN}} - ossrh_username: ${{secrets.OSSRH_TOKEN_USER}} - ossrh_token: ${{secrets.OSSRH_TOKEN_PASS}} - gpg_key: ${{secrets.GPG_KEY}} - gpg_passphrase: ${{secrets.GPG_PASSPHRASE}} - \ No newline at end of file + release_version: ${{ github.event.inputs.release_version }} \ No newline at end of file