forked from adempiere/eCommerce-docker
-
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
0186442
commit 80b93fe
Showing
1 changed file
with
106 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Container Registry and Docker Hub Regitry when a pushed into main branches | ||
# This file was contributed by [email protected] from ERP Consultores y Asociados, C.A | ||
|
||
name: Push Main Branches | ||
|
||
on: | ||
# Triggers the workflow on push events but only for the develop branch | ||
push: | ||
branches: | ||
- master | ||
- alpine | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
|
||
# Publish docker image in Github Container Registry to application | ||
push-imame-ghcr: | ||
name: Push Docker image to GitHub Container | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set Lower Case to owner and repository | ||
run: | | ||
echo "OWNER_LC=${OWNER,,}" >> ${GITHUB_ENV} | ||
echo "REPO_LC=${NAME,,}" >> ${GITHUB_ENV} | ||
env: | ||
OWNER: '${{ github.repository_owner }}' | ||
NAME: '${{ github.event.repository.name }}' | ||
|
||
- name: Get branch name | ||
id: branch-name | ||
uses: tj-actions/[email protected] | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: | | ||
ghcr.io/${{ env.OWNER_LC }}/${{ env.REPO_LC }}:${{ steps.branch-name.outputs.current_branch }} | ||
ghcr.io/${{ env.OWNER_LC }}/${{ env.REPO_LC }}:${{ github.sha }} | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
||
|
||
# Publish docker image in Docker Hub registry to application | ||
push-imame-dhr: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
# CONFIGURE DOCKER SECRETS INTO REPOSITORY | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set Lower Case to owner and repository | ||
run: | | ||
ORG=$OWNER | ||
if [ -n "${{ secrets.DOCKERHUB_ORG }}" ]; then | ||
echo "Set secret DOCKERHUB_ORG as namespace" | ||
ORG=${{ secrets.DOCKERHUB_ORG }} | ||
else | ||
echo "Set OWNER ($OWNER) as namespace " | ||
fi | ||
echo "ORG_LC=${ORG,,}" >> ${GITHUB_ENV} | ||
echo "OWNER_LC=${OWNER,,}" >> ${GITHUB_ENV} | ||
echo "REPO_LC=${NAME,,}" >> ${GITHUB_ENV} | ||
env: | ||
# to docker image namespace | ||
OWNER: '${{ github.repository_owner }}' | ||
NAME: '${{ github.event.repository.name }}' | ||
|
||
- name: Get branch name | ||
id: branch-name | ||
uses: tj-actions/[email protected] | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.ORG_LC }}/${{ env.REPO_LC }}:${{ steps.branch-name.outputs.current_branch }} | ||
${{ env.ORG_LC }}/${{ env.REPO_LC }}:${{ github.sha }} | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |