Skip to content

Commit

Permalink
Merge pull request #61 from entando/IT-298
Browse files Browse the repository at this point in the history
IT-298 Creating release branches if they don't exist
  • Loading branch information
BrenoQVDS authored Nov 2, 2023
2 parents 2e174d2 + 8271b66 commit aa3a77f
Showing 1 changed file with 63 additions and 3 deletions.
66 changes: 63 additions & 3 deletions .github/workflows/entando-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,39 @@ env:
RELEASE_TAG: v${{ github.event.client_payload.major }}.${{ github.event.client_payload.minor }}.${{ github.event.client_payload.patch }}${{ github.event.client_payload.suffix }}

jobs:
setup:
runs-on: ubuntu-latest
outputs:
entando_k8s_operator_release_branch_exists: ${{ steps.entando-k8s-operator-release-branch.outputs.entando-k8s-operator-exists }}
entando_releases_release_branch_exists: ${{ steps.entando-releases-release-branch.outputs.entando-releases-exists }}
steps:
- name: Checkout entando-k8s-operator-bundle
uses: actions/checkout@v3
with:
repository: ${{ env.ENTANDO_K8S_OPERATOR_BUNDLE_REPO }}
ref: develop
token: ${{ secrets.ENTANDO_BOT_TOKEN }}
fetch-depth: 0
- name: entando-k8s-operator ${{ env.RELEASE_BRANCH }} branch exists?
id: entando-k8s-operator-release-branch
run: |
echo "entando-k8s-operator-exists=$(git ls-remote --heads origin ${{ env.RELEASE_BRANCH }})" >> $GITHUB_OUTPUT
- name: Checkout entando-releases
uses: actions/checkout@v3
with:
repository: ${{ env.ENTANDO_RELEASES_REPO }}
ref: develop
token: ${{ secrets.ENTANDO_BOT_TOKEN }}
fetch-depth: 0
- name: entando-releases ${{ env.RELEASE_BRANCH }} branch exists?
id: entando-releases-release-branch
run: |
echo "entando-releases-exists=$(git ls-remote --heads origin ${{ env.RELEASE_BRANCH }})" >> $GITHUB_OUTPUT
release-entando-k8s-operator-bundle:
name: Release operator-bundle
runs-on: ubuntu-latest
needs: setup
steps:
# Validate client payload
- name: Validate client payload
Expand Down Expand Up @@ -79,8 +109,23 @@ jobs:
run: |
echo "DOCKER_HUB_REPOS=$(jq -c . < $DOCKER_HUB_REPOS_CONFIG_URL)" >> $GITHUB_ENV
- name: Checkout entando-k8s-operator-bundle to create ${{ env.RELEASE_BRANCH }}
uses: actions/checkout@v3
if: ${{ needs.setup.outputs.entando_k8s_operator_release_branch_exists == '' }}
with:
repository: ${{ env.ENTANDO_K8S_OPERATOR_BUNDLE_REPO }}
ref: develop
token: ${{ secrets.ENTANDO_BOT_TOKEN }}
fetch-depth: 0

- name: Create release branch ${{ env.RELEASE_BRANCH }}
if: ${{ needs.setup.outputs.entando_k8s_operator_release_branch_exists == '' }}
run: |
git checkout -b ${{ env.RELEASE_BRANCH }}
git push origin ${{ env.RELEASE_BRANCH }}
# Checkout the entando-k8s-operator-bundle repository
- name: Checkout entando-k8s-operator-bundle
- name: Checkout entando-k8s-operator-bundle ${{ env.RELEASE_BRANCH }}
uses: actions/checkout@v3
with:
repository: ${{ env.ENTANDO_K8S_OPERATOR_BUNDLE_REPO }}
Expand Down Expand Up @@ -357,10 +402,25 @@ jobs:
name: Release entando-releases
runs-on: ubuntu-latest
timeout-minutes: 5
needs: release-entando-k8s-operator-bundle
needs: [setup, release-entando-k8s-operator-bundle]
steps:
- name: Checkout entando-releases to create ${{ env.RELEASE_BRANCH }}
uses: actions/checkout@v3
if: ${{ needs.setup.outputs.entando_releases_release_branch_exists == '' }}
with:
repository: ${{ env.ENTANDO_RELEASES_REPO }}
ref: develop
token: ${{ secrets.ENTANDO_BOT_TOKEN }}
fetch-depth: 0

- name: Create release branch ${{ env.RELEASE_BRANCH }}
if: ${{ needs.setup.outputs.entando_releases_release_branch_exists == '' }}
run: |
git checkout -b ${{ env.RELEASE_BRANCH }}
git push origin ${{ env.RELEASE_BRANCH }}
# Checkout the entando-releases repository
- name: Checkout entando-releases
- name: Checkout entando-releases ${{ env.RELEASE_BRANCH }}
uses: actions/checkout@v3
with:
repository: ${{ env.ENTANDO_RELEASES_REPO }}
Expand Down

0 comments on commit aa3a77f

Please sign in to comment.