Cloud expo demo #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
ls -la | |
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) |