Skip to content

Commit

Permalink
fix: docker image ci
Browse files Browse the repository at this point in the history
  • Loading branch information
irtazaakram committed May 2, 2024
1 parent 25ae842 commit a19fbdb
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions .github/workflows/push-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
name: Build and Push Docker Images

on:
pull_request:
push:
branches:
- master
- open-release/**

jobs:
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- name: Checkout
uses: actions/checkout@v3

# Use the release name as the image tag if we're building an open release tag.
# Examples: if we're building 'open-release/olive.master', tag the image as 'olive.master'.
# Otherwise, we must be building from a push to master, so use 'latest'.
- name: Get tag name
id: get-tag-name
uses: actions/github-script@v5
uses: actions/github-script@v7
with:
script: |
const branchName = context.ref.split('/').slice(-1)[0];
Expand All @@ -28,37 +27,30 @@ jobs:
return tagName;
result-encoding: string

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push Dev Docker image
uses: docker/build-push-action@v4

uses: docker/build-push-action@v5
with:
push: true
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
target: dev
repository: openedx/edx-notes-api-dev
tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }}
platforms: linux/amd64,linux/arm64

# - name: Build and push prod Docker image
# uses: docker/build-push-action@v4
# uses: docker/build-push-action@v5
# with:
# push: true
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
# target: prod
# repository: openedx/edx-notes-api
# tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }}
# platforms: linux/amd64,linux/arm64
# platforms: linux/amd64,linux/arm64

0 comments on commit a19fbdb

Please sign in to comment.