Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Update README.md

Update README.md #28

Workflow file for this run

name: push-pipeline
on:
push:
branches:
- master
- staging
tags:
- "*"
jobs:
get-envs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- shell: bash
run: |
echo export IMG_TAG=${GITHUB_SHA::6} >> env-vars
- name: Uploading envs
uses: actions/upload-artifact@v2
with:
name: env_artifact
path: env-vars
docker-build-and-push:
runs-on: ubuntu-latest
needs:
- get-envs
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Downloading image artficate
uses: actions/download-artifact@v2
with:
name: env_artifact
- name: Build docker image
shell: bash
run: |
source env-vars
branch=${GITHUB_REF#refs/*/}
if [ $branch == "master" ]
then
docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${{ secrets.IMAGE_NAME }}:${IMG_TAG}
elif [ $branch == "staging" ]
then
docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${{ secrets.STAGING_IMAGE_NAME }}:${branch}-${IMG_TAG}
fi
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push docker image
shell: bash
run: |
branch=${GITHUB_REF#refs/*/}
source env-vars
if [ $branch == "master" ]
then
docker push ${{ secrets.REPONAME }}/${{ secrets.IMAGE_NAME }}:${IMG_TAG}
elif [ $branch == "staging" ]
then
docker push ${{ secrets.REPONAME }}/${{ secrets.STAGING_IMAGE_NAME }}:${branch}-${IMG_TAG}
fi