forked from nonfx/codepipes-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (65 loc) · 2.11 KB
/
infra.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
name: 'Infra'
on:
pull_request:
push:
branches:
- main
env:
PLATFORM_REPO: "cldcvr/terrarium"
PLATFORM_BRANCH: "main"
PLATFORM_DIR: "examples/platform-demo/platform"
TERRARIUM_VERSION: "v0.6"
TF_API_TOKEN: "${{ secrets.TF_API_TOKEN }}"
TF_CLOUD_ORGANIZATION: "kanak"
TF_WORKSPACE: "demo-go-pgsql-workflow"
TF_CONFIG_DIRECTORY: "./.terrarium-output"
jobs:
t8-generate:
name: "Terrarium generate"
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout Platform Repo
uses: actions/checkout@v3
with:
repository: ${{ env.PLATFORM_REPO }}
ref: ${{ env.PLATFORM_BRANCH }}
token: ${{ secrets.GH_TOKEN }}
path: "./.platform-repo"
- name: Terrarium Install
uses: supplypike/setup-bin@v3
with:
uri: 'https://github.com/cldcvr/terrarium/releases/download/${{ env.TERRARIUM_VERSION }}/terrarium-${{ env.TERRARIUM_VERSION }}-linux-amd64.tar.gz'
name: 'terrarium'
version: ${{ env.TERRARIUM_VERSION }}
- name: Terrarium Generate
run: |
terrarium generate -p .platform-repo/$PLATFORM_DIR -a . -o $TF_CONFIG_DIRECTORY/src
cp -r .platform-repo/examples/platform-demo/modules ./$TF_CONFIG_DIRECTORY/modules
- name: Archive Terrarium generated code
uses: actions/upload-artifact@v3
with:
name: terrarium-generate-code
path: ${{ env.TF_CONFIG_DIRECTORY }}
push-tf-code:
if: github.ref != 'refs/heads/main'
needs: t8-generate
name: "Push Terrarium Generate Code"
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Commit files
id: commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "Akash Jaiswal"
git add --all
git commit -m "Push Terrarium generated code" -a
git push -u origin $GITHUB_REF
SHA=$(git rev-parse HEAD)