diff --git a/.github/workflows/gh_release.yml b/.github/workflows/gh_release.yml index 81aabd183..cf1f7c712 100644 --- a/.github/workflows/gh_release.yml +++ b/.github/workflows/gh_release.yml @@ -6,6 +6,9 @@ on: ref: description: 'The commit to checkout (on master)' required: true +env: + YT_IMAGE_NAME: yt-backend + TK_IMAGE_NAME: tk-backend jobs: build: @@ -54,6 +57,44 @@ jobs: yarn guardoni build:app yarn ycai build + docker_backends: + steps: + - name: Log in to registry + # This is where you will update the personal access token to GITHUB_TOKEN + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Build & Push TK Backend image + run: | + VERSION=${{ steps.version.outputs.version }} + TK_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$TK_IMAGE_NAME + echo $IMAGE_ID + docker build . --file Dockerfile.tkbackend --tag $TK_IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + docker tag $TK_IMAGE_NAME $TK_IMAGE_ID:$VERSION + docker push $TK_IMAGE_ID:$VERSION + + - name: Build & Push YT Backend image + run: | + VERSION=${{ steps.version.outputs.version }} + YT_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$YT_IMAGE_NAME + echo $IMAGE_ID + docker build . --file Dockerfile.ytbackend --tag $YT_IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + docker tag $YT_IMAGE_NAME $YT_IMAGE_ID:$VERSION + docker push $YT_IMAGE_ID:$VERSION + guardoni_build: name: Guardoni build needs: [build] diff --git a/.github/workflows/master_release.yml b/.github/workflows/master_release.yml index b9334c4ac..40e4a51e0 100644 --- a/.github/workflows/master_release.yml +++ b/.github/workflows/master_release.yml @@ -9,7 +9,6 @@ permissions: contents: write jobs: - build: name: Build runs-on: ubuntu-latest diff --git a/.github/workflows/tk_pull_request.yml b/.github/workflows/tk_pull_request.yml index 73b756bac..66b27b797 100644 --- a/.github/workflows/tk_pull_request.yml +++ b/.github/workflows/tk_pull_request.yml @@ -15,6 +15,9 @@ on: - "packages/**" - "platforms/tktrex/**" +env: + TK_IMAGE_NAME: tk-backend + jobs: pull_request: runs-on: ubuntu-latest @@ -65,3 +68,12 @@ jobs: yarn pm2 start platforms/tktrex/backend/ecosystem.config.js --env test yarn tk:backend test --runInBand --ci --forceExit yarn pm2 stop all + + - name: Log in to registry + # This is where you will update the personal access token to GITHUB_TOKEN + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Build TK Backend image + run: docker build . --file Dockerfile.tkbackend --tag $TK_IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + + diff --git a/.github/workflows/yttrex_pull_request.yml b/.github/workflows/yt_pull_request.yml similarity index 79% rename from .github/workflows/yttrex_pull_request.yml rename to .github/workflows/yt_pull_request.yml index aec47f8a8..214c3c220 100644 --- a/.github/workflows/yttrex_pull_request.yml +++ b/.github/workflows/yt_pull_request.yml @@ -15,6 +15,9 @@ on: - "shared/**" - "platforms/yttrex/**" +env: + YT_IMAGE_NAME: yt-backend + jobs: pull_request: runs-on: ubuntu-latest @@ -71,3 +74,10 @@ jobs: yarn yt:backend test --runInBand --forceExit --ci yarn pm2 stop all + - name: Log in to registry + # This is where you will update the personal access token to GITHUB_TOKEN + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Build TK Backend image + run: docker build . --file Dockerfile.ytbackend --tag $YT_IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" +