-
-
Notifications
You must be signed in to change notification settings - Fork 11
65 lines (56 loc) · 1.58 KB
/
deploy.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
name: Deploy
on:
workflow_run:
workflows: ["Lint, Test, Build"]
branches:
- main
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: read
contents: read
deployments: read
packages: read
jobs:
build:
environment: production
if: github.event.workflow_run.conclusion == 'success'
name: Deploy to k8s
runs-on: ubuntu-latest
steps:
- name: Create SHA Container Tag
id: sha_tag
run: |
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v3
with:
repository: onerandomusername/kubernetes
token: ${{ secrets.REPO_TOKEN }}
- name: Install kubectl
uses: azure/setup-kubectl@v3.2
with:
version: 'latest'
- name: Authenticate with Kubernetes
uses: azure/k8s-set-context@v3
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBECONFIG }}
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Kubernetes
uses: azure/k8s-deploy@v4
with:
manifests: |
monty/deployment.yaml
images: 'ghcr.io/onerandomusername/monty-python:${{ steps.sha_tag.outputs.tag }}'
# annotate-namespace: false
# strategy: 'none'