-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (75 loc) · 2.23 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
86
87
88
89
90
91
92
name: Full Workflow with Manual Approval for Deploy
on:
push:
branches:
- main # Trigger this on push to the main branch
jobs:
build:
name: Build Stage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: '16'
# - name: Install dependencies
# run: npm install
- name: Build project
run: echo "npm run build"
test:
name: Test Stage
runs-on: ubuntu-latest
needs: build # Ensure test runs after build completes
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run tests
run: echo "npm test"
plan:
name: Plan Stage
runs-on: ubuntu-latest
needs: test # Ensure plan runs after test completes
steps:
- name: Checkout code
uses: actions/checkout@v2
# - name: Set up Terraform
# uses: hashicorp/setup-terraform@v2
# with:
# terraform_version: "1.5.0"
# - name: Terraform Init
# working-directory: ./terraform
# run: terraform init -input=false
- name: Terraform Plan
# working-directory: ./terraform
run: echo "terraform plan -out=tfplan.binary"
# - name: Show Plan
# working-directory: ./terraform
# run: terraform show -no-color tfplan.binary
# - name: Upload Plan Artifact
# uses: actions/upload-artifact@v2
# with:
# name: tfplan.binary
# path: ./terraform/tfplan.binary
deploy:
name: Deploy Stage
runs-on: ubuntu-latest
needs: plan # Ensure deploy runs after plan completes
environment:
name: production # This triggers environment approval
steps:
- name: Checkout code
uses: actions/checkout@v2
# - name: Download Plan Artifact
# uses: actions/download-artifact@v2
# with:
# name: tfplan.binary
# path: ./terraform
# - name: Set up Terraform
# uses: hashicorp/setup-terraform@v2
# with:
# terraform_version: "1.5.0"
- name: Terraform Apply
# working-directory: ./terraform
run: echo "end"