Skip to content

Commit

Permalink
version change validation
Browse files Browse the repository at this point in the history
  • Loading branch information
makeevrserg committed Sep 10, 2024
1 parent c08d9cb commit 295b0be
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/call-check-version-changed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Create artifacts"
on:
workflow_call:
outputs:
IS_SAME_VERSIONS:
description: "The name of requested build variant"
value: ${{ jobs.compare_versions.outputs.IS_SAME_VERSIONS }}
jobs:
# ${{ jobs.get_version_from_target_branch.outputs.TARGET_VERSION }}
get_version_from_target_branch:
name: Get version from target branch
runs-on: ubuntu-latest
outputs:
TARGET_VERSION: ${{ steps.properties.outputs.makeevrserg-project-version-string }}
steps:
- name: Checkout Git repo
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

# ${{ steps.properties.outputs.makeevrserg-project-version-string }}
- uses: christian-draeger/read-properties@1.1.1
id: properties
with:
path: './gradle.properties'
properties: 'makeevrserg.project.name makeevrserg.project.version.string'

# ${{ jobs.get_version_from_current_branch.outputs.CURRENT_VERSION }}
get_version_from_current_branch:
name: Get version from current branch
runs-on: ubuntu-latest
outputs:
CURRENT_VERSION: ${{ steps.properties.outputs.makeevrserg-project-version-string }}
steps:
- name: Checkout Git repo
uses: actions/checkout@v4

# ${{ steps.properties.outputs.makeevrserg-project-version-string }}
- uses: christian-draeger/read-properties@1.1.1
id: properties
with:
path: './gradle.properties'
properties: 'makeevrserg.project.name makeevrserg.project.version.string'

compare_versions:
name: "Compare versions ${{ jobs.get_version_from_target_branch.outputs.TARGET_VERSION }} and ${{ jobs.get_version_from_current_branch.outputs.CURRENT_VERSION }}"
runs-on: ubuntu-latest
outputs:
IS_SAME_VERSIONS: ${{ jobs.get_version_from_target_branch.outputs.TARGET_VERSION }} == ${{ jobs.get_version_from_current_branch.outputs.CURRENT_VERSION }}
25 changes: 23 additions & 2 deletions .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,36 @@ on:
- 'develop'
- 'master'
- 'rc'
merge_group:

# Concurrency strategy:
# github.workflow: distinguish this workflow from others
# github.event_name: distinguish `push` event from `pull_request` and 'merge_group' event
# github.ref_name: distinguish branch
# github.repository: distinguish owner+repository
#
# Reference:
# https://docs.github.com/en/actions/using-jobs/using-concurrency
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{github.ref_name}}-${{github.repository}}
cancel-in-progress: true

jobs:
gradle_validation:
name: "Gradle Wrapper"
uses: ./.github/workflows/call-gradle-wrapper-validation.yml
check_versions:
name: "Check version changed"
needs: gradle_validation
uses: ./.github/workflows/call-check-version-changed.yml
detekt_validation:
name: "Detekt"
needs: gradle_validation
if: ${{ jobs.check_versions.outputs.IS_SAME_VERSIONS }} == true
needs: [ gradle_validation,check_versions ]
uses: ./.github/workflows/call-detekt-validation.yml
tests_validation:
name: "Tests"
needs: gradle_validation
if: ${{ jobs.check_versions.outputs.IS_SAME_VERSIONS }} == true
needs: [ gradle_validation,check_versions ]
uses: ./.github/workflows/call-tests-validation.yml

0 comments on commit 295b0be

Please sign in to comment.