Skip to content

add loggin

add loggin #22

Workflow file for this run

name: "CD: staging"
on:
push:
branches:
- 'deploy-staging'
env:
TAG_VERSION: "v0-latest"
DOCKER_REPO_NAME: "backenddevelopersltd/compute-horde-prompt-solver-staging"
DIST_VERSION_PREFIX: "staging"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Docker build and push
run: |
IMAGE_NAME="${DOCKER_REPO_NAME}:${TAG_VERSION}"
SHA_IMAGE_NAME="${DOCKER_REPO_NAME}:git-${GITHUB_SHA}"
echo "Building image..."
docker build -o type=image,push=false -t "${IMAGE_NAME}" .
echo "Tagging image..."
docker image tag "${IMAGE_NAME}" "${SHA_IMAGE_NAME}"
echo "Login to DockerHub..."
echo "${{ secrets.DOCKERHUB_KEY }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
echo "Push to DockerHub..."
docker push "${IMAGE_NAME}"
docker push "${SHA_IMAGE_NAME}"
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Set Dist Version
run: |
BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"
echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV
- name: Create Tag
uses: actions/github-script@v6
with:
script: |
const {DIST_VERSION} = process.env
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${DIST_VERSION}`,
sha: context.sha
})