14
14
build-musl :
15
15
runs-on : ubuntu-latest
16
16
# So we need to put the condition in the if here
17
- if : ${{ (github.actor == github.event.repository.owner.login) && (github.ref == 'refs/heads/master ') }}
17
+ if : ${{ (github.actor == github.event.repository.owner.login) && (github.ref == 'refs/heads/main ') }}
18
18
19
19
steps :
20
20
- name : Run sccache-cache
40
40
with :
41
41
registry : ghcr.io
42
42
username : ${{ github.actor }}
43
- password : ${{ secrets.GITHUB_TOKEN }}
43
+ password : ${{ secrets.REGISTRY_TOKEN }}
44
44
45
45
46
46
- name : Build and push
@@ -53,20 +53,39 @@ jobs:
53
53
ghcr.io/guilamb/interspecies-reviewer:latest
54
54
ghcr.io/guilamb/interspecies-reviewer:${{ github.run_number }}
55
55
secrets : |
56
- "github_token=${{ secrets.GITHUB_TOKEN }}"
56
+ "github_token=${{ secrets.REGISTRY_TOKEN }}"
57
+
57
58
58
59
deploy :
59
- needs : build-musl
60
+ name : Deploy
60
61
runs-on : ubuntu-latest
62
+ needs : build-musl
63
+ if : github.actor == github.event.repository.owner.login
64
+
61
65
steps :
62
- - name : Set secret as environment variable
63
- env :
64
- DISCORD_TOKEN : ${{ secrets.DISCORD_TOKEN }}
65
- run : echo "DISCORD_TOKEN=$DISCORD_TOKEN" >> $GITHUB_ENV
66
+ - name : Set the Kubernetes context
67
+ uses : azure/k8s-set-context@v2
68
+ with :
69
+ method : service-account
70
+ k8s-url : ${{ secrets.SERVER_URL }}
71
+ k8s-secret : ${{ secrets.KUBERNETES_SECRET }}
72
+
73
+ - name : Checkout source code
74
+ uses : actions/checkout@v3
75
+
76
+ - name : Inject secret into manifest
77
+ run : awk -i inplace -v secret="${{ secrets.DISCORD_TOKEN }}" '{gsub("DISCORD_TOKEN_SECRET", secret)}1' kubernetes/deployment.yaml
66
78
67
- - name : Substitute secret in deployment YAML
68
- run : |
69
- envsubst < deployment.yaml > deployment_with_secret.yaml
70
79
71
- - name : Deploy to Kubernetes
72
- run : kubectl apply -f deployment_with_secret.yaml
80
+ - name : Deploy to the Kubernetes cluster
81
+ uses : azure/k8s-deploy@v1
82
+ with :
83
+ action : deploy
84
+ strategy : basic
85
+ namespace : interspecies-reviewer
86
+ manifests : |
87
+ kubernetes/deployment.yaml
88
+ images : |
89
+ ghcr.io/guilamb/interspecies-reviewer:latest
90
+ imagepullsecrets : |
91
+ github-container-registry
0 commit comments