Skip to content

CR deployment

CR deployment #15

Workflow file for this run

# This is a basic workflow that is manually triggered
# try to use as much shell scripting a possible
# actions appear from default branch - https://github.community/t/workflow-files-only-picked-up-from-master/16129/2
name: CR deployment
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
tag_gr:
description: 'git repo branch or tag'
default: 'main'
required: true
tag_ci:
description: 'container image tag'
default: 'latest'
required: true
env:
CR_IMAGENAME: ${{ vars.CR_IMAGENAME }} || ${{ github.event.repository.name }}
CR_PASSWORD: ${{ secrets.CR_PASSWORD }}
CR_USERNAME: ${{ secrets.CR_USERNAME }}
CR_HOST: ${{ vars.CR_HOST }}
CR_NS: ${{ vars.CR_NS }}
DOCKERFILE_TARGET: production # follow value in docker file
jobs:
deploy_to_cr:
runs-on: ubuntu-latest
name: Deploying CR
steps:
- name: Selected Branch/tag
run: echo ${{ github.event.inputs.tag_gr }}
- name: Add checkout plugin
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.tag_gr }}
- name: Build and push image to CR
env:
IMAGE_TARGET: production
IMAGE_TAG: ${{ github.sha }}
run: |
echo $CR_IMAGENAME
# cat password.txt |
# echo $CR_PASSWORD | docker login --username $CR_USERNAME --password-stdin $CR_HOST
# docker build -t $CR_HOST/$CR_NS/$CR_IMAGENAME:${{ github.event.inputs.tag_ci }} --target $DOCKERFILE_TARGET --build-arg ARG_NODE_ENV=$DOCKERFILE_TARGET --build-arg ARG_API_PORT=3000 . || exit 1001
# docker push $CR_HOST/$CR_NS/$CR_IMAGENAME:${{ github.event.inputs.tag_ci }}
# docker logout