-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.44 KB
/
dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 }}