Add workable ci workflow #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Chatbot-ui Workable CI | ||
on: | ||
push: | ||
branches: | ||
- main-workable | ||
pull_request: | ||
types: | ||
- opened | ||
branches: | ||
- main-workable | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "Set the image tag manually (will be created dynamically if not set)" | ||
default: "" | ||
required: false | ||
manual_build_branch: | ||
description: "The branch the image should be built from" | ||
type: string | ||
default: "main" | ||
required: true | ||
push_to_stg: | ||
description: "Build and push image to staging GCR" | ||
type: boolean | ||
default: false | ||
required: true | ||
push_to_prd: | ||
description: "Build and push image to production GCR" | ||
type: boolean | ||
default: false | ||
required: true | ||
jobs: | ||
set-ref: | ||
if: github.repository == 'Workable/chatbot-ui' | ||
name: retrieve the actual build branch | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ref-for-name: ${{ steps.set-branch.outputs.ref-for-name }} | ||
ref-for-checkout: ${{ steps.set-branch.outputs.ref-for-checkout }} | ||
steps: | ||
- name: set the build branch | ||
id: set-branch | ||
shell: bash | ||
run: | | ||
if [[ "${{ inputs.manual_build_branch }}" == "" ]]; then | ||
ACTUAL_BRANCH=${{ github.ref_name }} | ||
else | ||
ACTUAL_BRANCH=${{ inputs.manual_build_branch }} | ||
fi | ||
echo "ref-for-name=${ACTUAL_BRANCH#workable_feature/*}" >> $GITHUB_OUTPUT | ||
echo "ref-for-checkout=$ACTUAL_BRANCH" >> $GITHUB_OUTPUT | ||
set-tag: | ||
if: github.repository == 'Workable/chatbot-ui' | ||
name: set the image tag | ||
needs: | ||
- set-ref | ||
uses: Workable/chatbot-ui/.github/workflows/common_image_tagging_workflow.yaml@main-workable | ||
with: | ||
push_to_prd: ${{ inputs.push_to_prd == true }} | ||
tag: ${{ inputs.tag }} | ||
ref: ${{ needs.set-ref.outputs.ref-for-name }} | ||
build-and-push-docker-image: | ||
name: Build and push docker image | ||
if: github.repository == 'Workable/chatbot-ui' | ||
needs: | ||
- set-ref | ||
- set-tag | ||
uses: Workable/chatbot-ui/.github/workflows/common_build_and_push_to_gcr.yaml@main-workable | ||
with: | ||
environment: Workable | ||
dockerfile: Dockerfile.k8s | ||
build_branch: ${{ needs.set-ref.outputs.ref-for-checkout }} | ||
stg_image_build: ${{ inputs.push_to_stg == true || github.event_name == 'push' }} | ||
prd_image_build: ${{ inputs.push_to_prd == true }} | ||
image_name: chatbot-ui | ||
image_tag: ${{ needs.set-tag.outputs.tag }} | ||
no_cache: false | ||
secrets: | ||
SRE_GCR_SA: ${{ secrets.SRE_GCR_SA }} | ||
STAGING_GCR_SA: ${{ secrets.STAGING_GCR_SA }} | ||
PRODUCTION_GCR_SA: ${{ secrets.PRODUCTION_GCR_SA }} | ||
send-slack-success: | ||
name: Send Slack success message | ||
if: success() && github.repository == 'Workable/chatbot-ui' | ||
needs: | ||
- set-tag | ||
- build-and-push-docker-image | ||
uses: Workable/chatbot-ui/.github/workflows/common_image_slack_notification.yaml@main-workable | ||
Check failure on line 93 in .github/workflows/ci-workable.yaml
|
||
with: | ||
environment: Workable | ||
image_name: chatbot-ui | ||
image_tag: ${{ needs.set-tag.outputs.tag }} | ||
slack_channel: sre_bots | ||
stg_image_build: ${{ inputs.push_to_stg == true || github.event_name == 'push' }} | ||
prd_image_build: ${{ inputs.push_to_prd == true }} | ||
success: true | ||
secrets: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
send-slack-failure: | ||
name: Send Slack failure message | ||
if: failure() && github.repository == 'Workable/chatbot-ui' | ||
needs: | ||
- set-tag | ||
- build-and-push-docker-image | ||
uses: Workable/chatbot-ui/.github/workflows/common_image_slack_notification.yaml@main-workable | ||
with: | ||
environment: Workable | ||
image_name: chatbot-ui | ||
image_tag: ${{ needs.set-tag.outputs.tag }} | ||
slack_channel: sre_bots | ||
stg_image_build: ${{ inputs.push_to_stg == true || github.event_name == 'push' }} | ||
prd_image_build: ${{ inputs.push_to_prd == true }} | ||
success: false | ||
secrets: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |