Skip to content

1.0.5

1.0.5 #6

Workflow file for this run

# 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 Edwin Betancourt, [email protected]
name: Publish Project
on:
release:
types:
- created
- edited
jobs:
# Build dist application ADempiere-Site
build-pages:
name: Build dist ADempiere-Site
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Blog
env:
NODE_OPTIONS: --max_old_space_size=8192
run: pnpm run build:vite
- name: Upload dist files
uses: actions/upload-artifact@v3
with:
name: adempiere-site
path: dist
# Publish dist binaries to page
publish-app-dist:
name: Upload ADempiere-Site binaries
# TODO: Does not support edit release: {"resource":"Release","code":"already_exists","field":"tag_name"}
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
needs:
- build-pages
runs-on: ubuntu-latest
steps:
- name: Download build dist app
uses: actions/download-artifact@v3
with:
name: adempiere-site
- name: Compress files for application dist
uses: TheDoctor0/[email protected]
with:
filename: 'Adempiere-Site.zip'
path: './'
- name: Create checksum sha256 file
run: sha512sum Adempiere-Site.zip > Adempiere-Site.zip.sha512
- name: Publish application binary in repository
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'Adempiere-Site.zip'
- name: Publish checksum of file
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'Adempiere-Site.zip.sha512'
# Check secrets to push image in docker hub registry
check-docker-secrets:
name: Check if docker hub registry information was set on secrets
needs:
- build-pages
runs-on: ubuntu-latest
outputs:
is_have_secrets: ${{ steps.check_secret_job.outputs.is_have_secrets }}
steps:
- id: check_secret_job
run: |
if [[ "${{ secrets.DOCKER_HUB_REPO_NAME }}" != "" && \
"${{ secrets.DOCKER_USERNAME }}" != "" && \
"${{ secrets.DOCKER_TOKEN }}" != "" ]]; \
then
echo "Secrets to use a container registry are configured in the repo"
echo "is_have_secrets=true" >> $GITHUB_OUTPUT
else
echo "Secrets to use a container registry were not configured in the repo"
echo "is_have_secrets=false" >> $GITHUB_OUTPUT
fi
# Publish docker alpine image in Docker Hub registry to application
push-alpine-imame-dhr:
name: Push docker alpine image to Docker Hub
needs:
- check-docker-secrets
# Skip step based on secret
if: needs.check-docker-secrets.outputs.is_have_secrets == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Download build dist app
uses: actions/download-artifact@v3
with:
name: adempiere-site
path: dist
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker Image Alpine
uses: docker/[email protected]
with:
context: .
file: ./build-docker/production-alpine.Dockerfile
push: true
tags: |
${{ secrets.DOCKER_HUB_REPO_NAME }}:alpine
${{ secrets.DOCKER_HUB_REPO_NAME }}:alpine-${{ github.event.release.tag_name }}
# Publish docker image in Docker Hub registry to application
push-imame-dhr:
name: Push docker image to Docker Hub
needs:
- check-docker-secrets
# Skip step based on secret
if: needs.check-docker-secrets.outputs.is_have_secrets == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Download build dist app
uses: actions/download-artifact@v3
with:
name: adempiere-site
path: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ./build-docker/production.Dockerfile
platforms: linux/amd64,linux/amd64/v2,linux/arm64/v8
push: true
tags: |
${{ secrets.DOCKER_HUB_REPO_NAME }}:latest
${{ secrets.DOCKER_HUB_REPO_NAME }}:${{ github.event.release.tag_name }}