From ff06dc4694bbd6db0d918832f65a028832a49fb1 Mon Sep 17 00:00:00 2001 From: Yair Siman Tov <63305203+yairsimantov20@users.noreply.github.com> Date: Sun, 7 Jan 2024 19:07:38 +0200 Subject: [PATCH] Port-6005 ocean apply release workflow (#321) --- .github/workflows/apply-release.yml | 36 +++++++++++++++++++++-------- scripts/bump-all.sh | 2 +- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/apply-release.yml b/.github/workflows/apply-release.yml index f6b4aa8118..8dc4f203ef 100644 --- a/.github/workflows/apply-release.yml +++ b/.github/workflows/apply-release.yml @@ -16,28 +16,46 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Poetry + uses: snok/install-poetry@v1 + - name: Get package version + id: version run: | version=$(poetry search port-ocean | grep port-ocean | sed 's/.*(\(.*\))/\1/') - pr_name="Release ${version}" - branch_name="release-${version}" + pr_name="Apply Ocean version $version to all integrations" + branch_name="apply-ocean-$version-to-all-integrations" echo "Branch Name: $branch_name" echo "PR Name: $pr_name" - git checkout -b $branch_name + echo "pr_name=$pr_name" >> $GITHUB_OUTPUT + echo "branch_name=$branch_name" >> $GITHUB_OUTPUT + echo "version=$version" >> $GITHUB_OUTPUT - name: Apply changes run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - ./scripts/bump-all.sh + ./scripts/bump-all.sh ^${{ steps.version.outputs.version }} - git push origin $branch_name - name: Open pull request uses: peter-evans/create-pull-request@v3 with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "Propose changes" - title: $pr_name - body: "This pull request includes changes made in the feature branch." + token: ${{ secrets.MACHINE_USER_TOKEN }} + title: ${{ steps.version.outputs.pr_name }} + branch: ${{ steps.version.outputs.branch_name }} + base: main + body: | + This PR was automatically created by a GitHub Action. + + ## What does this PR do? + Apply Ocean version ${{ steps.version.outputs.version }} to all integrations + + ## How should this be manually tested? + ./scripts/bump-all.sh ^${{ steps.version.outputs.version }} diff --git a/scripts/bump-all.sh b/scripts/bump-all.sh index 7f57e3cdb6..a59acba308 100755 --- a/scripts/bump-all.sh +++ b/scripts/bump-all.sh @@ -46,6 +46,6 @@ for folder in "$(pwd)"/integrations/*; do echo "New version: $new_version" echo "Run towncrier build to increment the patcb version" - (cd "$folder" && source .venv/bin/activate && towncrier build --yes --version $new_version && rm changelog/1.improvement.md && git add . && git commit -m "Bumped ocean version to $VERSION for $(basename "$folder")") + (cd "$folder" && source .venv/bin/activate && towncrier build --yes --version $new_version && rm changelog/1.improvement.md && git add . && echo "committing $(basename "$folder")" && git commit -m "Bumped ocean version to $VERSION for $(basename "$folder")") fi done \ No newline at end of file