-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (76 loc) · 2.58 KB
/
packer-consul-gcp.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
name: Packer Consul GCP
on:
push:
branches: [develop, staging, master]
pull_request:
branches: [develop, staging, master]
types: [opened, synchronize]
jobs:
Validate-Packer:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
name: Validate-Packer
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Validate Template
uses: jveraduran/packer-github-actions@master
with:
command: validate
arguments: -syntax-only
target: aws/packer-consul.json.pkr.hcl
Format-Packer:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
name: Format-Packer
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Validate Template
uses: jveraduran/packer-github-actions@master
with:
command: fmt
target: aws/packer-consul.json.pkr.hcl
# Build:
# needs: [Validate-Packer,Format-Packer]
# if: ${{ (github.event_name == 'push') && always() }}
# runs-on: ubuntu-latest
# name: Build
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v2
# - name: Setup ENV
# shell: bash
# run: |-
# if [ ${{ github.event_name }} == "pull_request" ]; then
# branch=$(echo ${{ github.base_ref }} | tr / -)
# else
# branch=$(echo ${GITHUB_REF#refs/heads/} | tr / -)
# fi
# if [ $branch = "master" ]; then
# env="production";
# elif [ $branch = "develop" ]; then
# env="develop";
# elif [ $branch = "staging" ]; then
# env="staging";
# else
# echo "invalid environment"; exit -1
# fi
# echo "ENV=$(echo $env)" >> $GITHUB_ENV
# - name: Download Packer Plugin
# uses: jveraduran/packer-github-actions@master
# with:
# command: init
# target: aws/packer-gcp.json.pkr.hcl
# - name: Build Artifact
# uses: jveraduran/packer-github-actions@master
# with:
# command: build
# arguments: "-color=false -on-error=abort -force -var version=${{ github.run_number }}"
# target: aws/packer-gcp.json.pkr.hcl
# env:
# CONSUL_HTTP_ADDR: ${{ secrets.CONSUL_HTTP_ADDR }}
# CONSUL_HTTP_TOKEN: ${{ secrets.CONSUL_HTTP_TOKEN }}
# APP_ENV: ${{ env.ENV }}
# HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }}
# HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }}