Skip to content

Commit dfee37d

Browse files
committed
upload github actions
1 parent 9a3f542 commit dfee37d

File tree

6 files changed

+126
-115
lines changed

6 files changed

+126
-115
lines changed

.github/workflows/cd-deploy.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# .github/workflows/cd-deploy.yml
2+
name: CD – Build, Push & Deploy
3+
4+
on:
5+
push:
6+
branches: [ listOfMed ]
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
env:
13+
IMAGE_REG: ghcr.io/${{ github.repository_owner }}
14+
15+
jobs:
16+
build:
17+
name: Build & Push Production Images
18+
runs-on: ubuntu-latest
19+
outputs:
20+
tag: ${{ steps.set-vars.outputs.TAG }}
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Set version tag
25+
id: set-vars
26+
run: |
27+
# e.g. v1.2.3 or commit SHA fallback
28+
if [[ "${GITHUB_REF##*/}" =~ ^v[0-9] ]]; then
29+
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
30+
else
31+
echo "TAG=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
32+
fi
33+
34+
- name: Login to registry
35+
uses: docker/login-action@v2
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.repository_owner }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Build & push backend
42+
uses: docker/build-push-action@v3
43+
with:
44+
context: server
45+
file: server/Dockerfile.prod
46+
push: true
47+
tags: |
48+
${{ env.IMAGE_REG }}/balancer-backend:${{ needs.build.outputs.tag }}
49+
${{ env.IMAGE_REG }}/balancer-backend:latest
50+
51+
- name: Build & push frontend
52+
uses: docker/build-push-action@v3
53+
with:
54+
context: frontend
55+
file: frontend/Dockerfile
56+
push: true
57+
tags: |
58+
${{ env.IMAGE_REG }}/balancer-frontend:${{ needs.build.outputs.tag }}
59+
${{ env.IMAGE_REG }}/balancer-frontend:latest
60+
61+
# deploy:
62+
# name: Deploy to Kubernetes
63+
# needs: build
64+
# runs-on: ubuntu-latest
65+
# steps:
66+
# - uses: actions/checkout@v3
67+
68+
# - name: Set up kubectl
69+
# # or use azure/setup-kubectl, google-github-actions/setup-gcloud, etc.
70+
# uses: azure/setup-kubectl@v3
71+
# with:
72+
# version: 'latest'
73+
# # supply your kubeconfig via a secret
74+
# kubeconfig: ${{ secrets.KUBE_CONFIG_DATA }}
75+
76+
# - name: Update Helm chart values
77+
# run: |
78+
# helm upgrade --install balancer ./charts/balancer \
79+
# --namespace production \
80+
# --create-namespace \
81+
# --set backend.image.tag=${{ needs.build.outputs.tag }} \
82+
# --set frontend.image.tag=${{ needs.build.outputs.tag }}

.github/workflows/ci-build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# .github/workflows/ci-build.yml
2+
name: CI – Build & Push PR Images
3+
4+
on:
5+
pull_request:
6+
branches: [ listOfMed ]
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
19+
- name: Log in to registry
20+
uses: docker/login-action@v2
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.repository_owner }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Build & push backend
27+
uses: docker/build-push-action@v3
28+
with:
29+
context: server
30+
file: server/Dockerfile.prod
31+
push: true
32+
tags: |
33+
ghcr.io/${{ github.repository_owner }}/balancer-backend:pr-${{ github.event.number }}
34+
ghcr.io/${{ github.repository_owner }}/balancer-backend:pr-${{ github.event.number }}-latest
35+
36+
- name: Build & push frontend
37+
uses: docker/build-push-action@v3
38+
with:
39+
context: frontend
40+
file: frontend/Dockerfile
41+
push: true
42+
tags: |
43+
ghcr.io/${{ github.repository_owner }}/balancer-frontend:pr-${{ github.event.number }}
44+
ghcr.io/${{ github.repository_owner }}/balancer-frontend:pr-${{ github.event.number }}-latest

.github/workflows/containers-publish.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/release-prepare.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/release-publish.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/release-validate.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)