Skip to content

Commit

Permalink
Merge branch 'develop' into feature/MARP-721-Fix-Nginx-cannot-redirec…
Browse files Browse the repository at this point in the history
…t-user-after-authenticated-from-GitHub
  • Loading branch information
ndkhanh-axonivy committed Jul 24, 2024
2 parents 6ed7062 + ee52b0f commit cf28b8e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,25 @@ on:
workflow_call:

jobs:
build:
cleanup:
name: Clean up docker container and images
runs-on: self-hosted

steps:
- uses: actions/checkout@v4
- name: Bring down and remove containers and images
working-directory: ./marketplace-build
run: |
docker compose down --rmi all
build-and-deploy:
name: Build and bring up docker containers
runs-on: self-hosted
needs: cleanup

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Update environment variables for .env
env:
ENV_FILE: './marketplace-build/.env'
Expand Down Expand Up @@ -39,8 +53,7 @@ jobs:
sed -i "s/^MARKET_GITHUB_OAUTH_APP_CLIENT_SECRET=.*$/MARKET_GITHUB_OAUTH_APP_CLIENT_SECRET=$MARKET_GITHUB_OAUTH_APP_CLIENT_SECRET/" $ENV_FILE
sed -i "s/^MARKET_JWT_SECRET_KEY=.*$/MARKET_JWT_SECRET_KEY=$MARKET_JWT_SECRET_KEY/" $ENV_FILE
- name: Refresh Docker images
- name: Build and bring up containers without cache
working-directory: ./marketplace-build
run: |
docker compose down
docker compose up -d
docker compose up --build --force-recreate -d
21 changes: 21 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,46 @@ env:
jobs:

build:
name: Build Docker images
uses: ./.github/workflows/docker-build.yml

release:
name: Tag and publish image to GH packages
needs: build
runs-on: self-hosted
permissions:
packages: write
contents: read

steps:
- name: Wait for containers to be up and running
working-directory: ./marketplace-build
run: |
# Wait for up to 300 seconds for the containers to be up
timeout=300
start_time=$(date +%s)
while [ $(($(date +%s) - start_time)) -lt $timeout ]; do
if docker compose ps | grep -q "Up"; then
echo "Containers are up and running."
exit 0
fi
echo "Waiting for containers to start..."
sleep 5
done
echo "Containers did not start within the timeout period."
exit 1
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Refine release version
run: |
# This strips the git ref prefix from the version.
VERSION=${{ github.event.inputs.image_version }}
# This uses the Docker `latest` tag convention.
[ "$VERSION" == "main" ] && VERSION=latest
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Release Marketplace UI image
run: |
UI_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$UI_IMAGE_NAME
Expand Down

0 comments on commit cf28b8e

Please sign in to comment.