-
Notifications
You must be signed in to change notification settings - Fork 3
73 lines (69 loc) · 2.4 KB
/
pause-resources.yml
File metadata and controls
73 lines (69 loc) · 2.4 KB
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
name: Pause AWS Resources
on:
schedule:
- cron: "0 2 * * 2-6" # Runs every day at 6PM PST, Monday to Friday
workflow_dispatch:
inputs:
app_env:
description: 'Stack prefix to use for Pausing resources'
required: true
type: choice
default: dev
options:
- dev
- test
- prod
- all
workflow_call:
inputs:
app_env:
description: 'Stack prefix to use for Pausing resources'
required: false
type: string
default: dev
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for actions/checkout
jobs:
stack-prefix:
name: Stack Prefix
uses: ./.github/workflows/.stack-prefix.yml
pause-resources-dev:
name: Pause Resources Dev
if: (inputs.app_env == 'dev' || inputs.app_env == 'all' || github.event_name == 'schedule')
environment: prod # ::change it to:: dev , template repo only has PROD
needs: [stack-prefix]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
role-session-name: gha-pause-resources
aws-region: ca-central-1
- name: Pause AWS Resources
run: |
chmod +x ./.github/scripts/pause.sh
./.github/scripts/pause.sh dev ${{ needs.stack-prefix.outputs.stack_prefix }}
pause-resources-test:
name: Pause Resources Test
if: (inputs.app_env == 'test' || inputs.app_env == 'all' || github.event_name == 'schedule')
environment: prod # ::change it to:: test , template repo only has PROD
needs: [stack-prefix]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
role-session-name: gha-pause-resources
aws-region: ca-central-1
- name: Pause AWS Resources
shell: bash
run: |
chmod +x ./.github/scripts/pause.sh
./.github/scripts/pause.sh test ${{ needs.stack-prefix.outputs.stack_prefix }}