Skip to content

implement stable deploy #49

implement stable deploy

implement stable deploy #49

Workflow file for this run

name: Build and Deploy πŸš€
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build & Push πŸ› οΈ
runs-on: ubuntu-latest
outputs:
sha_short: ${{ steps.prepare.outputs.sha_short }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Preparing job
id: prepare
run: |
SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)
echo "SHA_SHORT=$SHA_SHORT"
echo "::set-output name=sha_short::$SHA_SHORT"
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Build and Push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
kennyd3d/hello-world-app:${{ steps.prepare.outputs.sha_short }}
kennyd3d/hello-world-app:dev
Deploy:
name: Deploy πŸš€
needs: build
uses: ./.github/workflows/deploy.yml
with:
namespace: "dev"
image: "kennyd3d/hello-world-app:${{ needs.build.outputs.sha_short }}"
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}