add workflow #1
This file contains hidden or 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: 'Terraform destroy' | ||
on: | ||
schedule: | ||
- cron: "0 0 15 * * 1-5 *" # UTC standard -> KRT = UTC + 9, KRT 13:00 = 04:00 + 9 | ||
permissions: | ||
contents: read | ||
jobs: | ||
terraform-destroy: | ||
name: 'Terraform destroy' | ||
runs-on: ubuntu-latest | ||
environment: production | ||
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
# Checkout the repository to the GitHub Actions runner | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# Install the latest version of Terraform CLI | ||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
# Configure AWS credentials | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# Create terraform.prod.tfvars file | ||
- name: Create terraform.prod.tfvars file | ||
run: echo "dockerhub_id = ${{ secrets.DOCKERHUB_id }}" >> terraform.prod.tfvars | ||
run: echo "dockerhub_pwd = ${{ secrets.DOCKERHUB_pwd }}" >> terraform.prod.tfvars | ||
# Create google cloud service account credential.json file | ||
- name: Configure GCP service account credentials | ||
run: echo ${{ secrets.GCP_SERVICE_ACCOUNT_JSON_VALUE }} > credentials.json | ||
# destroy GCP instance | ||
- name: Create GCP Compute Engine | ||
run: make clean |