-
Notifications
You must be signed in to change notification settings - Fork 2
122 lines (115 loc) · 5.28 KB
/
add-release-assets.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Generate and Upload Release assets
on:
release:
types: [ created ]
jobs:
build:
name: Add release chart configuration file
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Get chart name from release
id: get_chart
run: |
chartname=$(echo "${{ steps.get_release.outputs.tag_name }}" | grep -E "^(.*)-[0-9\.]+" -o | rev | cut -d'-' -f2- | rev)
chartversion=$(echo "${{ steps.get_release.outputs.tag_name }}" | grep -Eio "[0-9\.]+(-[^\+]+)?")
echo "::set-output name=chartname::$chartname"
echo "::set-output name=chartversion::$chartversion"
- name: check values.yaml exists
id: values_yaml_exists
uses: andstor/file-existence-action@v1
with:
files: "./charts/${{ steps.get_chart.outputs.chartname }}/values.yaml"
- name: add values.yaml to release asset
if: steps.values_yaml_exists.outputs.files_exists == 'true'
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./charts/${{ steps.get_chart.outputs.chartname }}/values.yaml
asset_name: ${{ steps.get_chart.outputs.chartname }}-configuration.yaml
asset_content_type: text/plain
- name: check values.schema.json exists
id: values_schema_exists
uses: andstor/file-existence-action@v1
with:
files: "./charts/${{ steps.get_chart.outputs.chartname }}/values.schema.json"
- name: add values.schema.json to release asset
uses: actions/upload-release-asset@v1.0.2
if: steps.values_schema_exists.outputs.files_exists == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./charts/${{ steps.get_chart.outputs.chartname }}/values.schema.json
asset_name: values.schema.json
asset_content_type: text/plain
- name: Install Helm
if: ${{ steps.get_chart.outputs.chartname == 'lm-container' }}
uses: azure/setup-helm@v1
with:
version: v3.5.4
- name: Wait for gh-pages to publish index.yaml
uses: lewagon/wait-on-check-action@v1.0.0
if: ${{ steps.get_chart.outputs.chartname == 'lm-container' }}
with:
ref: "gh-pages"
running-workflow-name: "pages-build-deployment"
repo-token: ${{ secrets.CHART_RELEASE_TOKEN }}
wait-interval: 10
#- name: checkout terraform-lmcontainer-kubernetes
- name: checkout terraform-lm-lmc
uses: actions/checkout@v3
with:
token: ${{ secrets.CHART_RELEASE_TOKEN }}
#repository: logicmonitor/terraform-lmcontainer-kubernetes
repository: vkumbhar94/terraform-lm-lmc
fetch-depth: 0
path: terraform-lm-lmc
ref: main
- name: Pull Charts and Generate UI Template
if: ${{ steps.get_chart.outputs.chartname == 'lm-container' }}
run: |
helm repo add logicmonitor-qa https://logicmonitor.github.io/helm-charts-qa
helm pull logicmonitor-qa/lm-container --untar --version ${{ steps.get_chart.outputs.chartversion }}
./scripts/lmui/lmui > lm-container-ui-jsonpaths.json
cat lm-container-ui-jsonpaths.json
#./scripts/lmtf/lmtf ./lm-container ./terraform-lmcontainer-kubernetes/templates/lmc-configuration.yaml ./terraform-lmcontainer-kubernetes/variables.tf
./scripts/lmtf/lmtf ./lm-container ./terraform-lm-lmc/templates/lmc-configuration.yaml ./terraform-lm-lmc/variables.tf
#echo "v${{ steps.get_chart.outputs.chartversion }}" > ./terraform-lmcontainer-kubernetes/version
echo "v${{ steps.get_chart.outputs.chartversion }}" > ./terraform-lm-lmc/version
- name: Upload ui template to release asset
uses: actions/upload-release-asset@v1.0.2
if: ${{ steps.get_chart.outputs.chartname == 'lm-container' }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./lm-container-ui-jsonpaths.json
asset_name: lm-container-ui-jsonpaths.json
asset_content_type: text/plain
- uses: hashicorp/setup-terraform@v2
if: ${{ steps.get_chart.outputs.chartname == 'lm-container' }}
- name: Terraform fmt
if: ${{ steps.get_chart.outputs.chartname == 'lm-container' }}
id: fmt
run: cd terraform-lm-lmc && terraform fmt && cd ..
continue-on-error: true
- name: Push Terraform Scripts
if: ${{ steps.get_chart.outputs.chartname == 'lm-container' }}
uses: stefanzweifel/git-auto-commit-action@v4
env:
GITHUB_TOKEN: ${{ secrets.CHART_RELEASE_TOKEN }}
with:
branch: main
#repository: terraform-lmcontainer-kubernetes
repository: terraform-lm-lmc
commit_message: "release(*): releasing new version"
file_pattern: "version templates/lmc-configuration.yaml variables.tf"