Skip to content

[Schedule] Restart #1007

[Schedule] Restart

[Schedule] Restart #1007

name: "[Schedule] Restart"
on:
schedule:
# UTC
- cron: "0 23 * * *"
workflow_dispatch:
jobs:
check_channels:
name: Check channels
runs-on: ubuntu-latest
steps:
- uses: denoland/setup-deno@v1
- uses: actions/checkout@v3
- name: Check number of channels
id: num_channels
run: echo "value=$(scripts/num-channels.ts)" >> $GITHUB_OUTPUT
- name: Warn if some channels are broadcasting
if: github.event_name != 'workflow_dispatch' && steps.num_channels.outputs.value > 0
run: echo '::warning::${{ steps.num_channels.outputs.value }} チャンネルが配信中ですが、無視して再起動します。'
- name: Warn if some channels are broadcasting
if: github.event_name == 'workflow_dispatch' && steps.num_channels.outputs.value > 0
run: echo '::warning::${{ steps.num_channels.outputs.value }} チャンネルが配信中ですが、手動実行なので再起動します。'
outputs:
num_channels: ${{ steps.num_channels.outputs.value }}
restart:
name: Restart
needs: check_channels
runs-on: ubuntu-latest
steps:
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.2.9
- uses: actions/checkout@v3
- name: Extract secrets
env:
GOOGLE_ENVIRONMENT_TARGET: production
GOOGLE_POWER: true
LOGFLARE_URI: /logs/json?api_key=${{ secrets.LOGFLARE_API_KEY }}&source=c565ddc7-1d34-4fd2-9e68-0b6339577dfa
TF_GOOGLE_CREDENTIAL_FILE: ${{ secrets.TF_GOOGLE_CREDENTIAL_FILE }}
TF_ROOT_CRT_FILE: ${{ secrets.TF_ROOT_CRT_FILE }}
TF_ROOT_KEY_FILE: ${{ secrets.TF_ROOT_KEY_FILE }}
TF_TERRAFORM_TFVARS: ${{ secrets.TF_TERRAFORM_TFVARS }}
working-directory: ./root
run: ./scripts/extract-secrets.sh
- name: Reverse terraform
working-directory: ./root
run: ./scripts/reverse-terraform.sh
- name: Terraform
working-directory: ./root
run: |
terraform taint google_compute_instance.tf_cloud_01 && \
terraform apply -auto-approve | sed --regexp-extended 's/value: \"[^\"]+\"/value: \"****\"/g'