Build and Deploy for Dev, QA, and Stable #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: Build and Deploy for Dev, QA, and Stable | |
on: | |
workflow_dispatch: | |
inputs: | |
RELEASE: | |
required: true | |
type: string | |
description: "The name of the release you want to deploy to stable" | |
env: | |
ARTIFACT_NAME: actions-demo | |
jobs: | |
deploy_stable: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Check if release exists in remote repo | |
run: | | |
IMAGE_STABLE="kennyd3d/${{ env.ARTIFACT_NAME }}:${{ github.event.inputs.RELEASE }}" | |
echo "IMAGE_STABLE=$IMAGE_STABLE" >> $GITHUB_ENV | |
if ! docker manifest inspect $IMAGE_STABLE > /dev/null 2>&1; then | |
echo "# ❌ Failed Stable Deployment: $IMAGE_STABLE not found in artifactory" >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
fi | |
- name: Deploy release to stable | |
run: | | |
echo "Test to deploy to Stable k8 using image ${{ env.IMAGE_STABLE }}" | |
- name: Give possible failure hint | |
if: failure() | |
run: | | |
echo "## Stable Failed to Deploy ${{ env.IMAGE_STABLE }}: Did you type the correct release name? 🤔" >> $GITHUB_STEP_SUMMARY | |
- name: Run success message on successful deployment | |
if: success() | |
run: | | |
echo "# 🎊 Successfully deployed ${{ env.IMAGE_STABLE }} to Stable ✅" >> $GITHUB_STEP_SUMMARY |