generated from LNA-DEV/README-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (74 loc) · 2.38 KB
/
HugoBuildAndDeploy.yaml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: HugoBuildAndDeploy
on:
workflow_dispatch:
push:
branches: [main]
env:
NAME: ./
CONTAINER-NAME: fedodo-home
jobs:
ReleaseVersion:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v3
# Install Hugo
- name: Hugo setup
uses: peaceiris/actions-hugo@v2.5.0
with:
extended: true
# Build the hugo repository
- run: hugo
working-directory: ./${{ env.NAME }}/
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: fedodo
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build . --file ./${{ env.NAME }}/Dockerfile --tag fedodo/${{ env.CONTAINER-NAME }}:${{ github.run_number }}
- name: Push the image to dockerhub
run: docker push fedodo/${{ env.CONTAINER-NAME }}:${{ github.run_number }}
ReleaseLatest:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v3
# Install Hugo
- name: Hugo setup
uses: peaceiris/actions-hugo@v2.5.0
with:
extended: true
# Build the hugo repository
- run: hugo
working-directory: ./${{ env.NAME }}/
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: fedodo
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build . --file ./${{ env.NAME }}/Dockerfile --tag fedodo/${{ env.CONTAINER-NAME }}:latest
- name: Push the image to dockerhub
run: docker push fedodo/${{ env.CONTAINER-NAME }}:latest
DeployContainer:
needs: ReleaseVersion
runs-on: ubuntu-latest
steps:
# Download Secure-File
- name: base64-to-file
id: write_file
uses: timheuer/base64-to-file@v1.1
with:
fileName: "custom-config"
encodedString: ${{ secrets.KUBECTL_CONFIG }}
# Checkout the repository
- uses: actions/checkout@v3
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "{{RUN_NUMBER}}"
replace: ${{ github.run_number }}
regex: false
# Deploy Kubernetes YAML
- run: kubectl apply -f ./Deployment/Kubernetes.yaml --kubeconfig ${{ steps.write_file.outputs.filePath }}