Skip to content

Commit

Permalink
test1
Browse files Browse the repository at this point in the history
  • Loading branch information
mfarhan943 committed Oct 3, 2024
1 parent e155b42 commit 461f56f
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions .github/workflows/push-registrar-image.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
name: Build and Push Registrar Image
name: Build and Push Docker Images

on:
workflow_dispatch:
inputs:
branch:
description: "Target branch from which the source dockerfile from image will be sourced"

schedule:
- cron: "0 4 * * 1-5" # UTC Time
pull_request:
branches:
- '**' # Trigger workflow on commits to any branch in a PR

jobs:
build-and-push-image:
build-and-push-docker-push:
runs-on: ubuntu-latest

steps:
- name: Get tag name
id: get-tag-name
uses: actions/github-script@v5
with:
script: |
const tagName = "${{ github.event.inputs.branch }}" || 'latest';
console.log('Will use tag: ' + tagName);
return tagName;
result-encoding: string
- name: Checkout code
uses: actions/checkout@v3

- name: Get commit SHA for tagging
id: get-commit-sha
run: echo "COMMIT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -42,17 +35,17 @@ jobs:
file: ./dockerfiles/registrar.Dockerfile
push: true
target: dev
tags: edxops/registrar-dev:${{ steps.get-tag-name.outputs.result }}
tags: farhan943/practise:${{ env.COMMIT_SHA }} # Use commit SHA as tag

- name: Send failure notification
if: failure()
uses: dawidd6/action-send-mail@v3
with:
server_address: email-smtp.us-east-1.amazonaws.com
server_port: 465
username: ${{secrets.edx_smtp_username}}
password: ${{secrets.edx_smtp_password}}
subject: Push Image to docker.io/edxops failed in registrar
to: [email protected]
username: ${{ secrets.edx_smtp_username }}
password: ${{ secrets.edx_smtp_password }}
subject: Docker Image push failed for commit ${{ env.COMMIT_SHA }}
to: [email protected]
from: github-actions <[email protected]>
body: Push Image to docker.io/edxops for registrar failed! For details see "github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
body: Docker image push failed for PR commit! For details see "github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

0 comments on commit 461f56f

Please sign in to comment.