Skip to content

Backup Current world #11

Backup Current world

Backup Current world #11

Workflow file for this run

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