Skip to content

Commit

Permalink
Merge pull request #76 from kloudlite/release-refactoring
Browse files Browse the repository at this point in the history
Release refactoring
  • Loading branch information
abdheshnayak authored Feb 5, 2024
2 parents 01503c7 + 340866a commit d8133bf
Show file tree
Hide file tree
Showing 28 changed files with 144 additions and 1,812 deletions.
55 changes: 49 additions & 6 deletions web/.github/workflows/build-container.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: build-docker-images

on:
pull_request:
push:
branches:
- release*
- release-*
tags:
- '*'
paths:
- "lib/**/**"
- "src/**"
Expand All @@ -29,6 +32,7 @@ jobs:
dockerFile: Dockerfile
- app: website
dockerFile: Dockerfile.devdoc

runs-on: ubuntu-latest
name: Deploy to Docker Image
steps:
Expand All @@ -48,12 +52,51 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create Image Tag from branch name
if: startsWith(github.ref, 'refs/heads/release-')
run: |
set +e
IMAGE_TAG=$(echo ${GITHUB_REF#refs/heads/release-})
echo "$IMAGE_TAG" | grep -i '\-nightly$'
if [ $? -ne 0 ]; then
IMAGE_TAG="$IMAGE_TAG-nightly"
fi
set -e
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
echo "OVERRIDE_PUSHED_IMAGE=true" >> $GITHUB_ENV
- name: Create Image Tag from tag
if: startsWith(github.ref, 'refs/tags/')
run: |
IMAGE_TAG=$(echo ${GITHUB_REF#refs/tags/})
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
echo "OVERRIDE_PUSHED_IMAGE=false" >> $GITHUB_ENV
- name: Build & Push Image
if: startsWith(github.ref, 'refs/heads/release')
if: startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/')
run: |
set +e
image_name="ghcr.io/${{ github.repository }}/${{matrix.app}}"
docker manifest inspect $image_name:$IMAGE_TAG
exit_status=$?
if [ $exit_status -eq 0 ]; then
[ "$OVERRIDE_PUSHED_IMAGE" = "false" ] && echo "image ($image_name:$IMAGE_TAG) already exists, and override image is disable, exiting" && exit 0
echo "image exists, but override pushed image is set to true. proceeding with building image"
fi
branch_name=${GITHUB_REF#refs/heads/}
version_string="v${branch_name#release-}-nightly"
set -e
docker build --build-arg APP=${{matrix.app}} -f ${{matrix.dockerFile}} . -t ghcr.io/kloudlite/web/${{matrix.app}}:$version_string --push
docker build --build-arg APP=${{matrix.app}} -f ${{matrix.dockerFile}} . -t ghcr.io/kloudlite/web/${{matrix.app}}:commit-${GITHUB_SHA} --push
docker build --build-arg APP=${{matrix.app}} -f ${{matrix.dockerFile}} . -t "$image_name:$IMAGE_TAG" --push
# - name: Build & Push Image
# if: startsWith(github.ref, 'refs/heads/release')
# run: |
# branch_name=${GITHUB_REF#refs/heads/}
# version_string="v${branch_name#release-}-nightly"
#
# docker build --build-arg APP=${{matrix.app}} -f ${{matrix.dockerFile}} . -t ghcr.io/kloudlite/web/${{matrix.app}}:$version_string --push
# docker build --build-arg APP=${{matrix.app}} -f ${{matrix.dockerFile}} . -t ghcr.io/kloudlite/web/${{matrix.app}}:commit-${GITHUB_SHA} --push
8 changes: 5 additions & 3 deletions web/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Release

on:
push:
tags: ['r*']
workflow_dispatch:

pull_request:
# push:
# tags: ['r*']

# pull_request:

# permissions:
# contents: write
Expand Down
6 changes: 3 additions & 3 deletions web/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tasks:
- |
BASE_URL=devc.kloudlite.io
COOKIE_DOMAIN=".kloudlite.io"
GATEWAY_URL="http://gateway.karthik-testing.svc.cluster.local"
GATEWAY_URL="http://gateway.kloudlite.svc.cluster.local"
case {{.app}} in
"auth")
PORT=4000
Expand Down Expand Up @@ -49,7 +49,7 @@ tasks:
esac
REMIX_DEV_ORIGIN="https://{{.app}}$URL_SUFFIX.devc.kloudlite.io"
cp -r ./static/common/. ./public/
cp -r ./static/{{.app}}/. ./public/

Expand Down Expand Up @@ -94,7 +94,7 @@ tasks:
BASE_URL=kloudlite.io
URL_SUFFIX=""
COOKIE_DOMAIN=".kloudlite.io"
GATEWAY_URL="http://gateway.karthik-testing.svc.cluster.local"
GATEWAY_URL="http://gateway.kloudlite.svc.cluster.local"
case {{.app}} in
"auth")
Expand Down
Loading

0 comments on commit d8133bf

Please sign in to comment.