From 636976bcd6e9956c5bc2975efec438bbf13babb8 Mon Sep 17 00:00:00 2001 From: ascariandrea Date: Mon, 7 Nov 2022 17:45:54 +0100 Subject: [PATCH] ci: build both yt:backend and tk:backend with docker as CI step --- .github/workflows/master_release.yml | 16 +++++++++++++++- .github/workflows/tk_pull_request.yml | 12 ++++++++++++ ...trex_pull_request.yml => yt_pull_request.yml} | 10 ++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) rename .github/workflows/{yttrex_pull_request.yml => yt_pull_request.yml} (79%) diff --git a/.github/workflows/master_release.yml b/.github/workflows/master_release.yml index b9334c4ac..18e04b314 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 @@ -155,6 +154,21 @@ jobs: git config --global user.name "Team - Tracking Exposed" yarn release-it --ci + # - name: Push image + # run: | + # IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$YT_IMAGE_NAME + + # # Strip git ref prefix from version + # VERSION=$(yarn release-it --no-github.release --release-version) + # # 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 $IMAGE_ID:$VERSION + # docker push $IMAGE_ID:$VERSION + - name: Build Dashboard env: DOTENV_CONFIG_PATH: .env 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}" +