Backup Current world #25
This file contains 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: 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@v4 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
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 |