Skip to content

Commit

Permalink
Merge pull request #181 from jamshale/release-improvements
Browse files Browse the repository at this point in the history
Release improvements
  • Loading branch information
jamshale authored Apr 24, 2024
2 parents 0f7d205 + 92bd383 commit 18bd3d5
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 30 deletions.
58 changes: 37 additions & 21 deletions .github/workflows/create-release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
integration_test_plugins: ${{ steps.integration_test_plugins.outputs.integration_test_plugins }}
integration_test_exit_code: ${{ steps.integration_test_plugins.outputs.integration_test_exit_code }}
all_potential_upgrades: ${{ steps.all_potential_upgrades.outputs.all_potential_upgrades }}
pr_body: ${{ steps.prepare_pr.outputs.pr_body }}
defaults:
run:
working-directory: .
Expand Down Expand Up @@ -214,20 +215,22 @@ jobs:
cd ../..
done
echo integration_test_plugins=${failed_plugins[*]} >> $GITHUB_OUTPUT
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#----------------------------------------------
# Prepare Pull Request
#----------------------------------------------
- name: Integration Test Failure Check
if: ${{ steps.integration_test_plugins.outputs.integration_test_exit_code }} == 17
run: |
echo "Integration tests failed with exit code 17. Skipping commit and release"
echo integration_test_exit_code=17 >> $GITHUB_OUTPUT
# ----------------------------------------------
# Prepare Pull Request
# ----------------------------------------------
- name: Prepare Pull Request
id: prepare_pr
run: |
echo "Merging failed plugins"
failed_plugins=()
integration_test_exit_code="${{ steps.integration_test_plugins.outputs.integration_test_exit_code }}"
echo "Integration test exit code: $integration_test_exit_code"
if [[ $integration_test_exit_code == "17" ]]; then
echo "Integration tests failed with exit code 17. Skipping commit and release"
exit 1
fi
# Merge all failed plugins
Expand Down Expand Up @@ -267,9 +270,6 @@ jobs:
git config --global user.name 'Release Bot'
git config --global user.email '[email protected]'
git remote set-url --push origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/hyperledger/aries-acapy-plugins
git fetch --all
git checkout -b "release-v$release_version"
# Add all the changed files and then remove the failed plugins
Expand All @@ -296,7 +296,6 @@ jobs:
upgraded_plugins=$(python repo_manager.py 5)
has_upgrades=false
echo
for plugin in ${potential_upgrades[@]}; do
for upgrade in ${upgraded_plugins[@]}; do
if [[ $plugin == *"$upgrade"* ]]; then
Expand All @@ -315,14 +314,31 @@ jobs:
fi
git commit -s -m "Release v$release_version Upgrades"
git push --set-upstream origin "release-v$release_version"
# Create the PR
details="Plugins upgraded this release: "
for plugin in ${upgraded_plugins}; do
details="$details $plugin"
done
title="Release for aries-cloudagent v$release_version"
gh pr create --title "$title" --body "$body $details" --base main --head "release-v$release_version"
# Prepare the PR body
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "pr_body<<$EOF" >> $GITHUB_OUTPUT
echo "$body $details" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
#----------------------------------------------
# Create Release PR
#----------------------------------------------
- name: Create PR
uses: peter-evans/create-pull-request@v6
with:
author: Release Bot <[email protected]>
committer: Release Bot <[email protected]>
token: ${{ secrets.BOT_PR_PAT }}
commit-message: "Release v${{ steps.current_available_version.outputs.current_available_version }}"
title: "Release for aries-cloudagent v${{ steps.current_available_version.outputs.current_available_version }}"
body: "Release v${{ steps.prepare_pr.outputs.pr_body }}"
branch: "release-v${{ steps.current_available_version.outputs.current_available_version }}"
base: "main"
draft: false
signoff: true
delete-branch: true
36 changes: 27 additions & 9 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
runs-on: ubuntu-latest
outputs:
should_create_release: ${{ steps.should_create_release.outputs.should_create_release }}
body: ${{ steps.prepare_release.outputs.body }}
tag: ${{ steps.prepare_release.outputs.tag }}
defaults:
run:
working-directory: .
Expand Down Expand Up @@ -65,12 +67,11 @@ jobs:
fi
echo should_create_release=$found_upgrade >> $GITHUB_OUTPUT
# ----------------------------------------------
# Create Release
# Prepare Release
# ----------------------------------------------
- name: Create Release
if: steps.should_create_release.outputs.should_create_release == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Release
id: prepare_release
if: steps.should_create_release.outputs.should_create_release == 'true'
run: |
echo "Creating release"
echo ${{ steps.should_create_release.outputs.should_create_release }}
Expand All @@ -79,7 +80,6 @@ jobs:
git config --global user.name 'Release Bot'
git config --global user.email '[email protected]'
git remote set-url --push origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/hyperledger/aries-acapy-plugins
git fetch --tags
# Determine the release tag
Expand Down Expand Up @@ -113,7 +113,25 @@ jobs:
details="$details $plugin"
done
git tag -a $release_tag -m "Release $tag"
git push origin $release_tag
gh release create $release_tag --title "Release for aries-cloudagent v$version" --notes "$body $details"
# Set the outputs
echo tag=$release_tag >> $GITHUB_OUTPUT
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "release_body<<$EOF" >> $GITHUB_OUTPUT
echo "$body $details" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
# ----------------------------------------------
# Create Release
# ----------------------------------------------
- name: Create Release
if: steps.should_create_release.outputs.should_create_release == 'true'
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.BOT_PR_PAT }}
release_name: ${{ steps.prepare_release.outputs.tag }}
body: ${{ steps.prepare_release.outputs.body }}
tag_name: ${{ steps.prepare_release.outputs.tag }}
prerelease: false

0 comments on commit 18bd3d5

Please sign in to comment.