-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (32 loc) · 1.2 KB
/
backup.yml
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
name: Backup Current world
on:
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
backup:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/minecraft-test-github-actions
role-session-name: github-actions-test-session
aws-region: ap-northeast-1
- name: Login to running container in ECS service and Execute back up cmd
run: |
CLUSTER=$(aws ecs list-clusters | jq -r '.clusterArns[0]' )
PREFIX=`echo ${CLUSTER} | sed -E 's/.+cluster\///g' `
TASK_ARN=$(aws ecs list-tasks --cluster ${CLUSTER} | jq -r '.taskArns[0]')
TASK_ID=`echo ${TASK_ARN} | sed -E 's/.+task\/.+\///g' `
CONTAINER_NAME="minecraft"
aws ecs execute-command \
--region ap-northeast-1 \
--cluster ${CLUSTER} \
--task ${TASK_ARN} \
--container ${CONTAINER_NAME}\
--command "/bin/sh -c '/scripts/backup.sh'" \
--interactive