-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: 'Release new versions' | ||
on: | ||
workflow_run: | ||
workflows: [Build rewrite] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
# Jobs will run only and only if the build action was successful | ||
check-build: | ||
runs-on: windows-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
|
||
# Only commits containing [RELEASE] will trigger this action | ||
check-commit: | ||
runs-on: windows-latest | ||
needs: check-build | ||
steps: | ||
- name: Checkout code | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Get Last Commit | ||
run: | | ||
$val = git show --pretty=format:"%s" -s HEAD | ||
echo "MESSAGE=$val" >> $env.GITHUB_ENV | ||
shell: pwsh | ||
|
||
- name: Extract Modules from Commit Message | ||
run: | | ||
$commitMessage = $env:LAST_COMMIT_TITLE | ||
$modules = [regex]::Matches($commitMessage, '(?<=\[RELEASE\] Modules: )([^,]+)') | ||
$moduleList = @() | ||
foreach ($module in $modules) { | ||
$moduleList += $module.Value.Trim() | ||
} | ||
echo "MODULES=$moduleList" >> $env:GITHUB_ENV | ||
shell: pwsh | ||
|
||
- name: Check Last Commit | ||
run: | | ||
if ($env:LAST_COMMIT_TITLE -match '\[RELEASE\]') { | ||
echo "EXECUTABLE=true" >> $env:GITHUB_ENV | ||
} else { | ||
echo "EXECUTABLE=false" >> $env:GITHUB_ENV | ||
} | ||
shell: pwsh | ||
|
||
release: | ||
runs-on: windows-latest | ||
needs: check-commit | ||
env: | ||
MESSAGE: ${{ needs.check-commit.env.MESSAGE }} | ||
MODULES: ${{ needs.check-commit.env.MODULES }} | ||
EXECUTABLE: ${{ needs.check-commit.env.EXECUTABLE }} | ||
if: ${{ env.EXECUTABLE == 'true' }} | ||
|
||
steps: | ||
- name: Checkout code | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '21' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Release modules | ||
run: | | ||
# Iterate over modules | ||
foreach ($module in $env.MODULES) { | ||
echo "Releasing module: $module" | ||
./gradlew $module:publish $module:closeAndReleaseRepository | ||
} | ||
shell: pwsh | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|