This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
85 lines (68 loc) · 2.15 KB
/
prod.yml
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
name: Tron Prod Build & Release
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
APP_NAMESPACE: tron
jobs:
build-image:
name: Build & Push Docker Image
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set BUILD_TAG Variable
id: buildTag
run: echo "BUILD_TAG=$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: |
"${{ secrets.IMAGE_NAME }}:${{ env.BUILD_TAG }}"
"${{ secrets.IMAGE_NAME }}:latest"
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
release-manifest:
name: Release Kubernetes Manifest
needs: 'build-image'
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: 4lch4/Replace Tokens
id: replaceTokens
uses: 4lch4/replace-tokens@v1.1.0
with:
files: manifest.yml
- name: Install Kubectl
uses: azure/setup-kubectl@v1
id: install
- name: Kubernetes set context
uses: Azure/k8s-set-context@v1.1
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- name: Deploy to Kubernetes cluster
run: kubectl apply -f ./manifest.yml --namespace ${{ env.APP_NAMESPACE }}
# uses: Azure/k8s-deploy@v1.3
# with:
# manifests: manifest.yml
# images: ${{ secrets.IMAGE_NAME }}:${{ env.BUILD_TAG }}
# imagePullSecrets: ${{ secrets.IMAGE_PULL_SECRET }}
# namespace: ${{ secrets.APP_NAMESPACE }}
# action: deploy
- uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}