forked from mpiorowski/late-sh
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (80 loc) · 3.06 KB
/
deploy.yml
File metadata and controls
92 lines (80 loc) · 3.06 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
on:
release:
types: [published]
concurrency:
group: ${{ (!endsWith(github.ref, '-infra') && !endsWith(github.ref, '-cli') && !endsWith(github.ref, '-web')) && format('deploy-standard-{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, '-infra') && !endsWith(github.ref, '-cli') && !endsWith(github.ref, '-web')"
uses: ./.github/workflows/ci.yml
with:
package: late-ssh
build_ssh:
name: build_late_ssh_image
if: "!endsWith(github.ref, '-infra') && !endsWith(github.ref, '-cli') && !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-ssh
image_tag: ${{ github.event.release.tag_name }}
context: .
dockerfile: ./Dockerfile
docker_target: runtime-ssh
environment: ${{ github.event.release.prerelease && 'staging' || 'production' }}
get_web_image:
name: get_current_web_image_tag
if: "!endsWith(github.ref, '-infra') && !endsWith(github.ref, '-cli') && !endsWith(github.ref, '-web')"
runs-on: ubuntu-latest
environment: ${{ github.event.release.prerelease && 'staging' || 'production' }}
outputs:
web_image_tag: ${{ steps.web_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_web_image_tag
id: web_image
run: |
tag=$(kubectl get deployment service-web -n default -o jsonpath='{.spec.template.spec.containers[0].image}')
echo "image_tag=$tag" >> "$GITHUB_OUTPUT"
terraform:
name: terraform_apply
if: "!endsWith(github.ref, '-infra') && !endsWith(github.ref, '-cli') && !endsWith(github.ref, '-web')"
needs: [build_ssh, get_web_image]
uses: ./.github/workflows/terraform.yml
permissions:
contents: read
secrets: inherit
with:
ssh_image_tag: ${{ needs.build_ssh.outputs.image_tag }}
web_image_tag: ${{ needs.get_web_image.outputs.web_image_tag }}
environment: ${{ github.event.release.prerelease && 'staging' || 'production' }}
wait_for_ssh_rollout:
name: wait_for_ssh_rollout
if: "!endsWith(github.ref, '-infra') && !endsWith(github.ref, '-cli') && !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-ssh -n default --timeout=180s