-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e61435d
commit fc07173
Showing
4 changed files
with
199 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Process Pending Feedbacks Deploy to Production | ||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
GITHUB_USERNAME: interviewandhealth | ||
IMAGE_NAME: cronjob/process-pending-feedbacks | ||
CLUSTER_USERNAME: InterviewAndHealth | ||
CLUSTER_REPOSITORY: Cluster | ||
BRANCH: main | ||
USERNAME: GopalSaraf | ||
ACCESS_TOKEN: ${{ secrets.PERSONEL_TOKEN }} | ||
FILE_PATH: services/cronjobs/process-pending-feedbacks/overlays/production/kustomization.yaml | ||
KEY: newTag | ||
ENVIRONMENT: production | ||
|
||
jobs: | ||
update: | ||
name: Deploy to Production | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate GHCR Token | ||
id: ghcr_token | ||
shell: bash | ||
run: | | ||
GHCR_TOKEN=$(echo ${{ secrets.PERSONEL_TOKEN }} | base64) | ||
echo "GHCR_TOKEN=$GHCR_TOKEN" >> $GITHUB_OUTPUT | ||
- name: Checkout Latest Image Tag | ||
id: checkout | ||
shell: bash | ||
run: | | ||
IMAGE_TAG=$(curl -H "Authorization: Bearer ${{ steps.ghcr_token.outputs.GHCR_TOKEN }}" https://ghcr.io/v2/${{ env.GITHUB_USERNAME }}/${{ env.IMAGE_NAME }}/tags/list | jq -r '.tags | map(select(test("^v[0-9]+$")))[-1]') | ||
# echo "::set-output name=IMAGE_TAG::$IMAGE_TAG" | ||
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_OUTPUT | ||
- name: Checkout Repository | ||
shell: bash | ||
run: | | ||
REPOSITORY=https://${{ env.USERNAME }}:${{ env.ACCESS_TOKEN }}@github.com/${{ env.CLUSTER_USERNAME }}/${{ env.CLUSTER_REPOSITORY }}.git | ||
git clone $REPOSITORY --depth 1 --branch ${{ env.BRANCH }} --single-branch . | ||
- name: Update Kustomization File | ||
shell: bash | ||
run: | | ||
sed -i "s/${{ env.KEY }}: .*/${{ env.KEY }}: ${{ steps.checkout.outputs.IMAGE_TAG }}/g" ${{ env.FILE_PATH }} | ||
- name: Commit Changes | ||
shell: bash | ||
run: | | ||
git config user.name "${{ env.USERNAME }}" | ||
git config user.email "${{ env.USERNAME }}@users.noreply.github.com" | ||
git add $FILE_PATH | ||
git commit -m "Update ${{ env.IMAGE_NAME }} image tag to ${{ steps.checkout.outputs.IMAGE_TAG }} in ${{ env.ENVIRONMENT }}" | ||
git pull --rebase | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: RabbitMQ Keepalive Deploy to Production | ||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
GITHUB_USERNAME: interviewandhealth | ||
IMAGE_NAME: cronjob/rabbitmq-keepalive | ||
CLUSTER_USERNAME: InterviewAndHealth | ||
CLUSTER_REPOSITORY: Cluster | ||
BRANCH: main | ||
USERNAME: GopalSaraf | ||
ACCESS_TOKEN: ${{ secrets.PERSONEL_TOKEN }} | ||
FILE_PATH: services/cronjobs/rabbitmq-keepalive/overlays/production/kustomization.yaml | ||
KEY: newTag | ||
ENVIRONMENT: production | ||
|
||
jobs: | ||
update: | ||
name: Deploy to Production | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate GHCR Token | ||
id: ghcr_token | ||
shell: bash | ||
run: | | ||
GHCR_TOKEN=$(echo ${{ secrets.PERSONEL_TOKEN }} | base64) | ||
echo "GHCR_TOKEN=$GHCR_TOKEN" >> $GITHUB_OUTPUT | ||
- name: Checkout Latest Image Tag | ||
id: checkout | ||
shell: bash | ||
run: | | ||
IMAGE_TAG=$(curl -H "Authorization: Bearer ${{ steps.ghcr_token.outputs.GHCR_TOKEN }}" https://ghcr.io/v2/${{ env.GITHUB_USERNAME }}/${{ env.IMAGE_NAME }}/tags/list | jq -r '.tags | map(select(test("^v[0-9]+$")))[-1]') | ||
# echo "::set-output name=IMAGE_TAG::$IMAGE_TAG" | ||
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_OUTPUT | ||
- name: Checkout Repository | ||
shell: bash | ||
run: | | ||
REPOSITORY=https://${{ env.USERNAME }}:${{ env.ACCESS_TOKEN }}@github.com/${{ env.CLUSTER_USERNAME }}/${{ env.CLUSTER_REPOSITORY }}.git | ||
git clone $REPOSITORY --depth 1 --branch ${{ env.BRANCH }} --single-branch . | ||
- name: Update Kustomization File | ||
shell: bash | ||
run: | | ||
sed -i "s/${{ env.KEY }}: .*/${{ env.KEY }}: ${{ steps.checkout.outputs.IMAGE_TAG }}/g" ${{ env.FILE_PATH }} | ||
- name: Commit Changes | ||
shell: bash | ||
run: | | ||
git config user.name "${{ env.USERNAME }}" | ||
git config user.email "${{ env.USERNAME }}@users.noreply.github.com" | ||
git add $FILE_PATH | ||
git commit -m "Update ${{ env.IMAGE_NAME }} image tag to ${{ steps.checkout.outputs.IMAGE_TAG }} in ${{ env.ENVIRONMENT }}" | ||
git pull --rebase | ||
git push |