From ef1b2e7b7f566c31cd2d10f8e1b8c87d2bae5e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 12 May 2021 08:52:39 +0200 Subject: [PATCH] Refactor to Ulf's suggestions --- .github/workflows/publish.yml | 30 +++++++++++++----------------- deployment/kubernetes/Chart.yaml | 4 ++-- package.json | 5 ++--- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 878bd1bce..f6d521a72 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,10 @@ name: ocelot.social publish branded CI -on: - push: - branches: - - master +# Wolle on: +# push: +# branches: +# - master +on: [push] jobs: ############################################################################## @@ -98,25 +99,20 @@ jobs: ########################################################################## - name: ENV - VERSION run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - - name: ENV - BUILD_NUMBER - run: echo "BUILD_NUMBER=$(node -p -e "require('./package.json').build-number")" >> $GITHUB_ENV - - name: ENV - DOCKER_ORGANISATION_SOURCE - run: echo "DOCKER_ORGANISATION_SOURCE=$(node -p -e "require('./package.json').docker-organisation-source")" >> $GITHUB_ENV - - name: ENV - DOCKER_ORGANISATION_PUSH - run: echo "DOCKER_ORGANISATION_PUSH=$(node -p -e "require('./package.json').docker-organisation-push")" >> $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').ocelot-docker-version-tag")" >> $GITHUB_ENV + - name: ENV - DOCKER_ORGANISATION + run: echo "DOCKER_ORGANISATION=$(node -p -e "require('./package.json').docker-organisation")" >> $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}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: ENV - BUILD_COMMIT - run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}-ocelot.social${OCELOT_DOCKER_VERSION_TAG}" >> $GITHUB_ENV ########################################################################## # BUILD WEBAPP DOCKER IMAGE (build) ###################################### ########################################################################## - name: webapp | Build `branded` image run: | - docker build --target branded -t "${DOCKER_ORGANISATION_PUSH}/webapp-branded:latest" -t "${DOCKER_ORGANISATION_PUSH}/webapp-branded:${VERSION}" -t "${DOCKER_ORGANISATION_PUSH}/webapp-branded:${BUILD_VERSION}" -f docker/webapp.Dockerfile --build-arg APP_IMAGE=${DOCKER_ORGANISATION_SOURCE}/webapp:${BUILD_VERSION} . - docker save "${DOCKER_ORGANISATION_PUSH}/webapp-branded" > /tmp/webapp-branded.tar + docker build --target branded -t "${DOCKER_ORGANISATION}/webapp-branded:latest" -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: diff --git a/deployment/kubernetes/Chart.yaml b/deployment/kubernetes/Chart.yaml index 14a8032db..5b953e3e7 100644 --- a/deployment/kubernetes/Chart.yaml +++ b/deployment/kubernetes/Chart.yaml @@ -5,9 +5,9 @@ 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: "1.0.2-79" +# 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: "1.0.2-79" +appVersion: "latest" description: The Helm chart for ocelot.social home: https://ocelot.social sources: diff --git a/package.json b/package.json index b483e1f88..7b6a8dee6 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,8 @@ { "name": "ocelot-social-branded", "version": "1.0.2", - "build-number": "79", - "docker-organisation-source": "ocelotsocialnetwork", - "docker-organisation-push": "ocelotsocialnetwork", + "ocelot-docker-version-tag": "1.0.2-79", + "docker-organisation": "ocelotsocialnetwork", "description": "Ocelot Social Branded", "author": "ocelot.social Community", "license": "MIT",