Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: 🍰 Implement Use Of package.json 'Version' Etc. For Build And Refine Helm Chart #8

Merged
merged 12 commits into from
May 15, 2021
126 changes: 109 additions & 17 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,51 @@ on:
push:
branches:
- master
# on: [push] # for testing while developing

jobs:
##############################################################################
# JOB: DOCKER BUILD COMMUNITY NEO4J ##########################################
##############################################################################
build_production_neo4j:
name: Docker Build Branded - Neo4j Community
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# SET ENVS ###############################################################
##########################################################################
- name: ENV - VERSION
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
- name: ENV - BUILD_DATE
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: ENV - OCELOT_DOCKER_VERSION_TAG
run: echo "OCELOT_DOCKER_VERSION_TAG=$(node -p -e "require('./package.json').ocelotDockerVersionTag")" >> $GITHUB_ENV
- name: ENV - DOCKER_ORGANISATION
run: echo "DOCKER_ORGANISATION=$(node -p -e "require('./package.json').dockerOrganisation")" >> $GITHUB_ENV
# this is oriented on the node docker version tag "node:12.19.0-alpine3.10" and looks like "app-branded:1.0.2-3-ocelot.social1.0.2-79"
- name: ENV - BUILD_VERSION
run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}-ocelot.social${OCELOT_DOCKER_VERSION_TAG}" >> $GITHUB_ENV
- name: ENV - BUILD_COMMIT
run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
##########################################################################
# BUILD NEO4J DOCKER IMAGE (community-branded) ###########################
##########################################################################
- name: Neo4j | Build `community-branded` image
run: |
docker build --target community-branded -t "${DOCKER_ORGANISATION}/neo4j-community-branded:latest" -t "${DOCKER_ORGANISATION}/neo4j-community-branded:${VERSION}" -t "${DOCKER_ORGANISATION}/neo4j-community-branded:${BUILD_VERSION}" -f docker/neo4j.Dockerfile --build-arg APP_IMAGE=ocelotsocialnetwork/neo4j:${OCELOT_DOCKER_VERSION_TAG} .
docker save "${DOCKER_ORGANISATION}/neo4j-community-branded" > /tmp/neo4j-community-branded.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: docker-neo4j-community-branded
path: /tmp/neo4j-community-branded.tar

##############################################################################
# JOB: DOCKER BUILD BRANDED BACKEND ##########################################
##############################################################################
Expand All @@ -26,17 +69,22 @@ jobs:
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
- name: ENV - BUILD_DATE
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: ENV - OCELOT_DOCKER_VERSION_TAG
run: echo "OCELOT_DOCKER_VERSION_TAG=$(node -p -e "require('./package.json').ocelotDockerVersionTag")" >> $GITHUB_ENV
- name: ENV - DOCKER_ORGANISATION
run: echo "DOCKER_ORGANISATION=$(node -p -e "require('./package.json').dockerOrganisation")" >> $GITHUB_ENV
# this is oriented on the node docker version tag "node:12.19.0-alpine3.10" and looks like "app-branded:1.0.2-3-ocelot.social1.0.2-79"
- name: ENV - BUILD_VERSION
run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}-ocelot.social${OCELOT_DOCKER_VERSION_TAG}" >> $GITHUB_ENV
- name: ENV - BUILD_COMMIT
run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
##########################################################################
# BUILD BACKEND DOCKER IMAGE (branded) ################################
##########################################################################
- name: backend | Build `branded` image
run: |
docker build --target branded -t "ocelotsocialnetwork/backend-branded:latest" -t "ocelotsocialnetwork/backend-branded:${VERSION}" -t "ocelotsocialnetwork/backend-branded:${BUILD_VERSION}" -f docker/backend.Dockerfile .
docker save "ocelotsocialnetwork/backend-branded" > /tmp/backend-branded.tar
docker build --target branded -t "${DOCKER_ORGANISATION}/backend-branded:latest" -t "${DOCKER_ORGANISATION}/backend-branded:${VERSION}" -t "${DOCKER_ORGANISATION}/backend-branded:${BUILD_VERSION}" -f docker/backend.Dockerfile --build-arg APP_IMAGE=ocelotsocialnetwork/backend:${OCELOT_DOCKER_VERSION_TAG} .
docker save "${DOCKER_ORGANISATION}/backend-branded" > /tmp/backend-branded.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -63,17 +111,22 @@ jobs:
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
- name: ENV - BUILD_DATE
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: ENV - OCELOT_DOCKER_VERSION_TAG
run: echo "OCELOT_DOCKER_VERSION_TAG=$(node -p -e "require('./package.json').ocelotDockerVersionTag")" >> $GITHUB_ENV
- name: ENV - DOCKER_ORGANISATION
run: echo "DOCKER_ORGANISATION=$(node -p -e "require('./package.json').dockerOrganisation")" >> $GITHUB_ENV
# this is oriented on the node docker version tag "node:12.19.0-alpine3.10" and looks like "app-branded:1.0.2-3-ocelot.social1.0.2-79"
- name: ENV - BUILD_VERSION
run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}-ocelot.social${OCELOT_DOCKER_VERSION_TAG}" >> $GITHUB_ENV
- name: ENV - BUILD_COMMIT
run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
##########################################################################
# BUILD WEBAPP DOCKER IMAGE (build) ######################################
##########################################################################
- name: webapp | Build `branded` image
run: |
docker build --target branded -t "ocelotsocialnetwork/webapp-branded:latest" -t "ocelotsocialnetwork/webapp-branded:${VERSION}" -t "ocelotsocialnetwork/webapp-branded:${BUILD_VERSION}" -f docker/webapp.Dockerfile .
docker save "ocelotsocialnetwork/webapp-branded" > /tmp/webapp-branded.tar
docker build --target branded -t "${DOCKER_ORGANISATION}/webapp-branded:latest" -t "${DOCKER_ORGANISATION}/webapp-branded:${VERSION}" -t "${DOCKER_ORGANISATION}/webapp-branded:${BUILD_VERSION}" -f docker/webapp.Dockerfile --build-arg APP_IMAGE=ocelotsocialnetwork/webapp:${OCELOT_DOCKER_VERSION_TAG} .
docker save "${DOCKER_ORGANISATION}/webapp-branded" > /tmp/webapp-branded.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -100,17 +153,22 @@ jobs:
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
- name: ENV - BUILD_DATE
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: ENV - OCELOT_DOCKER_VERSION_TAG
run: echo "OCELOT_DOCKER_VERSION_TAG=$(node -p -e "require('./package.json').ocelotDockerVersionTag")" >> $GITHUB_ENV
- name: ENV - DOCKER_ORGANISATION
run: echo "DOCKER_ORGANISATION=$(node -p -e "require('./package.json').dockerOrganisation")" >> $GITHUB_ENV
# this is oriented on the node docker version tag "node:12.19.0-alpine3.10" and looks like "app-branded:1.0.2-3-ocelot.social1.0.2-79"
- name: ENV - BUILD_VERSION
run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}-ocelot.social${OCELOT_DOCKER_VERSION_TAG}" >> $GITHUB_ENV
- name: ENV - BUILD_COMMIT
run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
##########################################################################
# BUILD MAINTENANCE DOCKER IMAGE (build) #################################
##########################################################################
- name: maintenance | Build `branded` image
run: |
docker build --target branded -t "ocelotsocialnetwork/maintenance-branded:latest" -t "ocelotsocialnetwork/maintenance-branded:${VERSION}" -t "ocelotsocialnetwork/maintenance-branded:${BUILD_VERSION}" -f docker/maintenance.Dockerfile .
docker save "ocelotsocialnetwork/maintenance-branded" > /tmp/maintenance-branded.tar
docker build --target branded -t "${DOCKER_ORGANISATION}/maintenance-branded:latest" -t "${DOCKER_ORGANISATION}/maintenance-branded:${VERSION}" -t "${DOCKER_ORGANISATION}/maintenance-branded:${BUILD_VERSION}" -f docker/maintenance.Dockerfile --build-arg APP_IMAGE=ocelotsocialnetwork/maintenance:${OCELOT_DOCKER_VERSION_TAG} .
docker save "${DOCKER_ORGANISATION}/maintenance-branded" > /tmp/maintenance-branded.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -134,22 +192,49 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# SET ENVS ###############################################################
##########################################################################
- name: ENV - VERSION
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
- name: ENV - BUILD_DATE
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: ENV - OCELOT_DOCKER_VERSION_TAG
run: echo "OCELOT_DOCKER_VERSION_TAG=$(node -p -e "require('./package.json').ocelotDockerVersionTag")" >> $GITHUB_ENV
- name: ENV - DOCKER_ORGANISATION
run: echo "DOCKER_ORGANISATION=$(node -p -e "require('./package.json').dockerOrganisation")" >> $GITHUB_ENV
# this is oriented on the node docker version tag "node:12.19.0-alpine3.10" and looks like "app-branded:1.0.2-3-ocelot.social1.0.2-79"
- name: ENV - BUILD_VERSION
run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}-ocelot.social${OCELOT_DOCKER_VERSION_TAG}" >> $GITHUB_ENV
- name: ENV - BUILD_COMMIT
run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
##########################################################################
# DOWNLOAD DOCKER IMAGES #################################################
##########################################################################
# Neo4j Community
- name: Download Docker Image (Neo4j Community)
uses: actions/download-artifact@v2
with:
name: docker-neo4j-community-branded
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/neo4j-community-branded.tar
# Backend
- name: Download Docker Image (Backend)
uses: actions/download-artifact@v2
with:
name: docker-backend-branded
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/backend-branded.tar
- name: Download Docker Image (WebApp)
# Webapp
- name: Download Docker Image (Webapp)
uses: actions/download-artifact@v2
with:
name: docker-webapp-branded
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/webapp-branded.tar
# Maintenance
- name: Download Docker Image (Maintenance)
uses: actions/download-artifact@v2
with:
Expand All @@ -162,12 +247,14 @@ jobs:
##########################################################################
- name: login to dockerhub
run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
- name: Push backend
run: docker push --all-tags ocelotsocialnetwork/backend-branded
- name: Push webapp
run: docker push --all-tags ocelotsocialnetwork/webapp-branded
- name: Push maintenance
run: docker push --all-tags ocelotsocialnetwork/maintenance-branded
- name: Push Neo4j Community
run: docker push --all-tags ${DOCKER_ORGANISATION}/neo4j-community-branded
- name: Push Backend
run: docker push --all-tags ${DOCKER_ORGANISATION}/backend-branded
- name: Push Webapp
run: docker push --all-tags ${DOCKER_ORGANISATION}/webapp-branded
- name: Push Maintenance
run: docker push --all-tags ${DOCKER_ORGANISATION}/maintenance-branded

##############################################################################
# JOB: GITHUB TAG LATEST VERSION #############################################
Expand All @@ -191,8 +278,13 @@ jobs:
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
- name: ENV - BUILD_DATE
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: ENV - OCELOT_DOCKER_VERSION_TAG
run: echo "OCELOT_DOCKER_VERSION_TAG=$(node -p -e "require('./package.json').ocelotDockerVersionTag")" >> $GITHUB_ENV
- name: ENV - DOCKER_ORGANISATION
run: echo "DOCKER_ORGANISATION=$(node -p -e "require('./package.json').dockerOrganisation")" >> $GITHUB_ENV
# this is oriented on the node docker version tag "node:12.19.0-alpine3.10" and looks like "app-branded:1.0.2-3-ocelot.social1.0.2-79"
- name: ENV - BUILD_VERSION
run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}-ocelot.social${OCELOT_DOCKER_VERSION_TAG}" >> $GITHUB_ENV
- name: ENV - BUILD_COMMIT
run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
##########################################################################
Expand Down
4 changes: 2 additions & 2 deletions deployment/kubernetes/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ version: "1.0.0"
# The appVersion defines which docker image is pulled.
# Having it set to latest will pull the latest build on dockerhub.
# You are free to define a specific version here tho.
# e.g. appVersion: "0.6.10"
# Be aware that this requires all dockers to have the same version available.
# e.g. appVersion: "latest" or "1.0.2-3-ocelot.social1.0.2-79"
# Be aware that this requires all your apps to have the same docker image version available.
appVersion: "latest"
description: The Helm chart for ocelot.social
home: https://ocelot.social
Expand Down
Loading