diff --git a/.github/workflows/create-hotfix-branch.yml b/.github/workflows/create-hotfix-branch.yml index 6526986..2be7f77 100644 --- a/.github/workflows/create-hotfix-branch.yml +++ b/.github/workflows/create-hotfix-branch.yml @@ -12,8 +12,8 @@ jobs: name: Create New Hotfix Branch runs-on: ubuntu-latest - # Only allow these users to create new hotfix branch from 'master' - if: github.ref == 'refs/heads/master' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'utsabc' || github.actor == 'shrouti1507') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'utsabc') + # Only allow these users to create new hotfix branch from 'testci-master' + if: github.ref == 'refs/heads/testci-master' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'utsabc' || github.actor == 'shrouti1507') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'utsabc') steps: - name: Create Branch uses: peterjgrainger/action-create-branch@v2.4.0 diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 52a2ffe..7f7c75b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,7 +1,12 @@ name: Docker Image CI for shopify-tracker on: push: - branches: [ master ] + branches: [ testci-master ] + pull_request: + types: + - closed + branches: + - testci-master permissions: read-all @@ -26,14 +31,46 @@ jobs: - name: Get image version id: get-version run: | - VERSION=$(echo "${{ github.event.pull_request.head.ref }}" | sed 's/^release\///;s/^hotfix-release\///') - echo $VERSION + VERSION=$(jq -r .version package.json) + echo "Version: $VERSION" echo "::set-output name=version::$VERSION" - - name: Build the Docker image and push run: | docker build -f Dockerfile -t rudderstack/rudder-shopify-tracker:${{steps.get-version.outputs.version}} . + - name: Push the image to Dockerhub run: | - docker push rudderstack/rudder-shopify-tracker:${{steps.get-version.outputs.version}} \ No newline at end of file + docker push rudderstack/rudder-shopify-tracker:${{steps.get-version.outputs.version}} + + - name: Clone Devops Repo + run: | + git clone https://${{secrets.PAT}}@github.com/rudderlabs/rudder-devops.git + + - name: Extract branch name + id: extract_branch_name + run: | + cd rudder-devops + branch_name=$(git rev-parse --abbrev-ref HEAD) + echo "branch_name=$branch_name" + echo "branch_name=$branch_name" >> $GITHUB_OUTPUT + + + - name: Update Helm Chart and Raise Pull Request For Shopify Tracker + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + SP_IMAGE_REPOSITORY: rudderstack/rudder-shopify-tracker + VERSION: ${{steps.get-version.outputs.version}} + run: | + cd rudder-devops + git checkout -b shopify-tracker-$VERSION ${{steps.extract_branch_name.outputs.branch_name}} + + cd helm-charts/helm/shopify-tracking + yq eval -i ".image.tag=\"$VERSION\"" values.yaml + yq eval -i ".image.repository=\"$SP_IMAGE_REPOSITORY\"" values.yaml + git add values.yaml + + git commit -m "chore: upgrade shopify tracker to $VERSION" + git push -u origin shopify-tracker-$VERSION + + hub pull-request -m "chore: upgrade shopify tracker to $VERSION" \ No newline at end of file diff --git a/.github/workflows/publish-new-release.yml b/.github/workflows/publish-new-release.yml index aa24791..ad8a84a 100644 --- a/.github/workflows/publish-new-release.yml +++ b/.github/workflows/publish-new-release.yml @@ -5,7 +5,7 @@ on: types: - closed branches: - - master + - testci-master jobs: release: @@ -64,8 +64,8 @@ jobs: - name: Pull Changes Into develop Branch uses: repo-sync/pull-request@v2.12.1 with: - source_branch: 'master' - destination_branch: 'develop' + source_branch: 'testci-master' + destination_branch: 'testci-develop' github_token: ${{ secrets.GITHUB_TOKEN }} pr_title: 'chore(release): pull main into develop post release v${{ steps.extract-version.outputs.release_version }}' pr_body: ':crown: *An automated PR*'