forked from edx/public-dockerfiles
-
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
e155b42
commit 461f56f
Showing
1 changed file
with
17 additions
and
24 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
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 | ||
|
@@ -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 }}" |