mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-07 18:25:45 +08:00
feat: Push docker image with commit. (#1071)
* feat: Push docker image with commit. * only use develop as main branch.
This commit is contained in:
parent
3e22f12a1c
commit
3978eb8fd5
150
.github/workflows/push-image.yml
vendored
Normal file
150
.github/workflows/push-image.yml
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
# 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 Edwin Betancourt 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:
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
|
||||
# Build dist application ADempiere-Vue
|
||||
build-app:
|
||||
name: Build dist ADempiere-Vue
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Node configuration
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Set tag version into config file
|
||||
run: sed -i "s|releaseNoForDocumentation|${{ github.event.release.tag_name }}|g" config/default.json
|
||||
- name: Install packages
|
||||
run: npm ci
|
||||
- name: Run test
|
||||
run: npm test
|
||||
- name: Compile dist
|
||||
run: npm run build:prod --if-present
|
||||
|
||||
- name: Upload dist app
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: adempiere-vue
|
||||
path: dist
|
||||
|
||||
# Publish docker image in Github Container Registry to application
|
||||
push-imame-ghcr:
|
||||
name: Push Docker image to GitHub Container
|
||||
needs:
|
||||
- build-app
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Download build dist app
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: adempiere-vue
|
||||
path: dist
|
||||
|
||||
- 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/branch-names@v4.8
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/Dockerfile.prod
|
||||
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
|
||||
needs:
|
||||
- build-app
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Download build dist app
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: adempiere-vue
|
||||
path: dist
|
||||
|
||||
- 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/branch-names@v4.8
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/Dockerfile.prod
|
||||
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 }}
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -17884,15 +17884,9 @@
|
||||
}
|
||||
},
|
||||
"vue-loader-v16": {
|
||||
<<<<<<< HEAD
|
||||
"version": "npm:vue-loader@16.4.1",
|
||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.4.1.tgz",
|
||||
"integrity": "sha512-nL1bDhfMAZgTVmVkOXQaK/WJa9zFDLM9vKHbh5uGv6HeH1TmZrXMWUEVhUrACT38XPhXM4Awtjj25EvhChEgXw==",
|
||||
=======
|
||||
"version": "npm:vue-loader@16.5.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.5.0.tgz",
|
||||
"integrity": "sha512-WXh+7AgFxGTgb5QAkQtFeUcHNIEq3PGVQ8WskY5ZiFbWBkOwcCPRs4w/2tVyTbh2q6TVRlO3xfvIukUtjsu62A==",
|
||||
>>>>>>> develop
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user