# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages # This file was contributed by Carlos Parada and Yamel Senih from ERP Consultores y Asociados, C.A name: Publish Project on: release: types: - created - edited 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 dist binaries to application publish-app-dist: name: Upload ADempiere-Vue binaries needs: - build-app runs-on: ubuntu-latest steps: - name: Download build dist app uses: actions/download-artifact@v2 with: name: adempiere-vue - name: Compress files for application dist uses: TheDoctor0/zip-release@0.6.0 with: filename: 'Adempiere-Vue.zip' path: './' - name: Publish application binary in repository uses: skx/github-action-publish-binaries@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: args: 'Adempiere-Vue.zip' # 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: Build and push Docker image uses: docker/build-push-action@v2 with: context: . file: ./build/Dockerfile.prod push: true # load: true tags: | ghcr.io/${{ env.OWNER_LC }}/${{ env.REPO_LC }}:latest ghcr.io/${{ env.OWNER_LC }}/${{ env.REPO_LC }}:${{ github.sha }} ghcr.io/${{ env.OWNER_LC }}/${{ env.REPO_LC }}:${{ github.event.release.tag_name }} - 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: 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 }}:latest ${{ env.ORG_LC }}/${{ env.REPO_LC }}:${{ github.sha }} ${{ env.ORG_LC }}/${{ env.REPO_LC }}:${{ github.event.release.tag_name }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} # Build dist documentation ADempiere-Vue build-docs: name: Build dist ADempiere-Vue docs 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: Generate dist docs run: | cd docs npm i npm run build --if-present - name: Upload dist docs uses: actions/upload-artifact@v2 with: name: adempiere-vue-docs path: docs/.vuepress/dist # Publish dist binaries to documentation publish-docs-dist: name: Upload ADempiere-Vue docs binaries needs: - build-docs runs-on: ubuntu-latest steps: - name: Download build dist docs uses: actions/download-artifact@v2 with: name: adempiere-vue-docs - name: Compress files for documentation dist uses: TheDoctor0/zip-release@0.6.0 with: filename: 'Adempiere-Vue-Documentation.zip' path: './' - name: Publish documentation binary in repository uses: skx/github-action-publish-binaries@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: args: 'Adempiere-Vue-Documentation.zip'