Skip to content

Commit

Permalink
Fix hulk deployment (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruuushhh committed Jun 13, 2024
1 parent 2eb0f6a commit 34dccf9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/create_release_branch.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Create Release Branch

on:
schedule:
# Run every Friday at 11:30 AM UTC (5:00 PM IST)
- cron: '30 11 * * FRI'

jobs:
create-release-branch:
runs-on: ubuntu-latest
Expand All @@ -11,26 +13,31 @@ jobs:
uses: actions/checkout@v3
with:
ref: master

- name: Get Release Branch Name
run: |
echo "release_branch=qbd_api_release_$(date +%Y_%m_%d)" >> $GITHUB_ENV
echo "last_release_branch=qbd_api_release_$(date -d 'last friday' +%Y_%m_%d)" >> $GITHUB_ENV
- name: Check if release branch exists
run: |
if git ls-remote --exit-code --heads origin ${{env.release_branch}}; then
echo "branch_exists=true" >> $GITHUB_ENV
else
echo "branch_exists=false" >> $GITHUB_ENV
fi
- name: Create release branch
if: ${{env.branch_exists == 'false'}}
run: |
git checkout -b ${{env.release_branch}}
git push origin ${{env.release_branch}}
echo "message=Branch `${{env.release_branch}}` created successfully." >> $GITHUB_ENV
- name: Branch already exists
if: ${{env.branch_exists == 'true'}}
run: echo "message=Branch `${{env.release_branch}}` already exists." >> $GITHUB_ENV

- name: Send message on Slack
uses: archive/[email protected]
id: notify
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/hulk_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,52 @@ on:
push:
branches:
- 'qbd_api_release_*'
workflow_run:
workflows: ["Create Release Branch"]
types:
- completed

jobs:
hulk_deploy:
name: Hulk Release Pipeline
runs-on: ubuntu-latest
environment: Staging
steps:
- uses: actions/checkout@v2

- name: Run CI
id: run-ci
run: |
echo "Running ci"
- name: Get Release branch name if workflow_run
if: github.event_name == 'workflow_run'
run: |
echo "release_branch=qbd_api_release_$(date +%Y_%m_%d)" >> $GITHUB_ENV
- name: Checkout to Release branch if workflow_run
uses: actions/checkout@v4
if: github.event_name == 'workflow_run'
with:
ref: ${{env.release_branch}}

- name: Verify current branch
run: git branch --show-current

- name: Push to dockerhub
if: ${{ success() }}
uses: fylein/docker-release-action@master
id: generate-and-push-tag
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE_NAME: fyle_qbd-api

- name: Print docker image version
run: |
NEW_TAG=${{ steps.generate-and-push-tag.outputs.new_tag }}
echo "docker image version: $NEW_TAG"
- name: Install kustomize
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
Expand Down

0 comments on commit 34dccf9

Please sign in to comment.