forked from mpiorowski/late-sh
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (80 loc) · 2.65 KB
/
deploy_web.yml
File metadata and controls
92 lines (80 loc) · 2.65 KB
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
name: deploy_web
on:
release:
types: [published]
concurrency:
group: ${{ endsWith(github.ref, '-web') && format('deploy-web-{0}', github.event.release.prerelease && 'staging' || 'production') || format('{0}-{1}', github.workflow, github.run_id) }}
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
ci:
name: ci
if: endsWith(github.ref, '-web')
uses: ./.github/workflows/ci.yml
with:
package: late-web
build_web:
name: build_late_web_image
if: endsWith(github.ref, '-web')
needs: ci
uses: ./.github/workflows/build.yml
permissions:
contents: read
packages: write
secrets: inherit
with:
registry: ghcr.io
image_name: late-web
image_tag: ${{ github.event.release.tag_name }}
context: .
dockerfile: ./Dockerfile
docker_target: runtime-web
environment: ${{ github.event.release.prerelease && 'staging' || 'production' }}
get_ssh_image:
name: get_current_ssh_image_tag
if: endsWith(github.ref, '-web')
runs-on: ubuntu-latest
environment: ${{ github.event.release.prerelease && 'staging' || 'production' }}
outputs:
ssh_image_tag: ${{ steps.ssh_image.outputs.image_tag }}
steps:
- name: setup_kubectl
uses: azure/setup-kubectl@v5
- name: set_kubernetes_context
uses: azure/k8s-set-context@v5
with:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- name: get_ssh_image_tag
id: ssh_image
run: |
tag=$(kubectl get deployment service-ssh -n default -o jsonpath='{.spec.template.spec.containers[0].image}')
echo "image_tag=$tag" >> "$GITHUB_OUTPUT"
terraform:
name: terraform_apply
if: endsWith(github.ref, '-web')
needs: [build_web, get_ssh_image]
uses: ./.github/workflows/terraform.yml
permissions:
contents: read
secrets: inherit
with:
ssh_image_tag: ${{ needs.get_ssh_image.outputs.ssh_image_tag }}
web_image_tag: ${{ needs.build_web.outputs.image_tag }}
environment: ${{ github.event.release.prerelease && 'staging' || 'production' }}
wait_for_web_rollout:
name: wait_for_web_rollout
if: endsWith(github.ref, '-web')
needs: terraform
runs-on: ubuntu-latest
environment: ${{ github.event.release.prerelease && 'staging' || 'production' }}
steps:
- name: setup_kubectl
uses: azure/setup-kubectl@v5
- name: set_kubernetes_context
uses: azure/k8s-set-context@v5
with:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- name: wait_for_rollout
run: kubectl rollout status deployment service-web -n default --timeout=180s