-
Notifications
You must be signed in to change notification settings - Fork 38
85 lines (76 loc) · 2.66 KB
/
deploy.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: Deploy
on:
push:
branches:
- main
pull_request:
types: [labeled, synchronize]
workflow_dispatch:
env:
WERF_ENV: "production"
WERF_REPO: "ghcr.io/${{ github.repository_owner }}/werfio-guides"
WERF_STAGES_STORAGE: "ghcr.io/werf/werfio-guides-stages"
WERF_SET_ACTIVE_RELEASE: "global.active_release=2"
WERFIO_GITHUB_TOKEN: "${{ secrets.API_TOKEN }}"
jobs:
converge:
name: Deploy
if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'test website') || contains(github.event.pull_request.labels.*.name, 'stage website')
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate artifacts
if: github.ref == 'refs/heads/main'
run: |
cd .werf/artifacts
bash generate_artifacts.sh
- name: Install werf
uses: werf/actions/install@v2
- name: Deploy to test
if: contains(github.event.pull_request.labels.*.name, 'test website')
run: |
. $(werf ci-env github --as-file)
werf converge
env:
WERF_NAMESPACE: "werfio-test"
WERF_RELEASE: "werfio-site-test"
WERF_LOG_VERBOSE: "on"
WERF_ENV: "test"
WERF_KUBE_CONFIG_BASE64: ${{ secrets.KUBECONFIG_BASE64_DEV }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to stage
if: contains(github.event.pull_request.labels.*.name, 'stage website')
run: |
. $(werf ci-env github --as-file)
werf converge
env:
WERF_NAMESPACE: "werfio-stage"
WERF_RELEASE: "werfio-site-stage"
WERF_LOG_VERBOSE: "on"
WERF_ENV: "stage"
WERF_KUBE_CONFIG_BASE64: ${{ secrets.KUBECONFIG_BASE64_DEV }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to production
if: github.ref == 'refs/heads/main'
run: |
. $(werf ci-env github --as-file)
werf converge
env:
WERF_NAMESPACE: "werfio-production"
WERF_RELEASE: "werfio-site-production"
WERF_LOG_VERBOSE: "on"
WERF_ENV: "production"
WERF_KUBE_CONFIG_BASE64: ${{ secrets.KUBECONFIG_BASE64_PROD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
notification:
name: Notification
if: always()
needs: converge
uses: werf/common-ci/.github/workflows/notification.yml@main
secrets:
loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }}
webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }}
notificationChannel: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }}