Skip to content

add support for labeling resources #177

add support for labeling resources

add support for labeling resources #177

Workflow file for this run

---
name: "Deployment"
on:
push:
paths:
- ".github/workflows/cd.yml"
- ".github/workflows/destroy.yml"
- "setup.py"
- "terraform/**"
- "treehouse/**"
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./terraform
steps:
- uses: actions/checkout@v2
- name: Set environment vars
run: |
echo "PYTHON_VERSION=3.8" >> $GITHUB_ENV
echo "PLATFORM_TOOLS_VERSION=$(python setup.py --version)" >> $GITHUB_ENV
working-directory: ./
- name: Use default workspace (main branch)
if: endsWith(github.ref, '/main')
run: |
echo "WORKSPACE=default" >> $GITHUB_ENV
- name: Use custom workspace (feature branch)
if: endsWith(github.ref, '/main') == false
run: |
echo "WORKSPACE=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Create package with dependencies
run: |
python setup.py bdist_egg --dist-dir .
working-directory: ./
- name: Rename egg
run: |
mv platform_tools-${{ env.PLATFORM_TOOLS_VERSION }}-py${{ env.PYTHON_VERSION }}.egg platform_tools.egg
working-directory: ./
- name: Put variables in env var
run: |
echo "VARIABLES_JSON={\"git_branch\": \"${GITHUB_REF#refs/heads/}\", \"platform_tools_artifact_filename\": \"platform_tools.egg\"}" >> $GITHUB_ENV
- uses: Pararius/[email protected]
with:
google_credentials: ${{ secrets.GCLOUD_AUTH_TF_RW }}
terraform_directory: ./terraform
terraform_do_apply: true
terraform_do_destroy: false
terraform_lock: true
terraform_variables: ${{ env.VARIABLES_JSON }}
terraform_workspace: ${{ env.WORKSPACE }}
- name: Send alert for failing apply on main
if: endsWith(github.ref, '/main')
uses: ravsamhq/notify-slack-action@v1
with:
status: ${{ job.status }}
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}