From 3f16060fd7382d6ed7595507bbba01a90928b4ef Mon Sep 17 00:00:00 2001 From: YK <81808708+yk-eukarya@users.noreply.github.com> Date: Mon, 19 Jun 2023 12:46:12 +0300 Subject: [PATCH 1/6] imp --- .github/workflows/deploiy_aws.yml | 72 +++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/deploiy_aws.yml diff --git a/.github/workflows/deploiy_aws.yml b/.github/workflows/deploiy_aws.yml new file mode 100644 index 0000000000..1e41e29f9d --- /dev/null +++ b/.github/workflows/deploiy_aws.yml @@ -0,0 +1,72 @@ +name: deploy-aws +on: + workflow_dispatch: + inputs: + keyId: + description: 'You can override the AWS access key id, or keep it empty to use the default from the secrets' + required: false + default: ${{ secrets.AWS_ACCESS_KEY_ID }} + secretAccessKey: + description: 'You can override the AWS secret access key, or keep it empty to use the default from the secrets' + required: false + default: ${{ secrets.AWS_SECRET_ACCESS_KEY }} +env: + # server + IMAGE: reearth/reearth:nightly + IMAGE_AWS: reearth-test-server:latest + +jobs: +# deploy_web: +# name: Deploy web to AWS +# runs-on: ubuntu-latest +# defaults: +# run: +# working-directory: web +# steps: +# - name: Set up Node.js +# uses: actions/setup-node@v3 +# with: +# node-version: lts/* +# - name: Configure AWS credentials +# uses: aws-actions/configure-aws-credentials@v1 +# with: +# aws-access-key-id: ${{ github.events.inputs.keyId }} +# aws-secret-access-key: ${{ github.events.inputs.secretAccessKey }} +# aws-region: us-east-1 +# - name: Install Amplify CLI +# run: yarn global add @aws-amplify/cli +# - name: Download artifact +# uses: dawidd6/action-download-artifact@v2 +# with: +# github_token: ${{ secrets.GITHUB_TOKEN }} +# workflow: ci_web.yml +# workflow_conclusion: success +# branch: main +# name: reearth-cms-web +# - name: Extract artifact +# run: tar -xf reearth-cms-web.tar.gz +# - name: Initialize Amplify +# run: amplify init --appId ${{ secrets.AWS_AMPLIFY_APP_ID }} --envName test --yes +# - name: Build and Deploy to Amplify +# run: amplify publish --appId ${{ secrets.AWS_AMPLIFY_APP_ID }} --envName test --yes + + deploy_server: + name: Deploy server to AWS + runs-on: ubuntu-latest + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ github.events.inputs.keyId }} + aws-secret-access-key: ${{ github.events.inputs.secretAccessKey }} + aws-region: us-west-2 + + - name: Log in to AWS ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: docker pull, push to ECR + run: | + docker pull $IMAGE + docker tag $IMAGE ${{ steps.login-ecr.outputs.registry }}/$IMAGE_AWS + docker push ${{ steps.login-ecr.outputs.registry }}/$IMAGE_AWS From 138bc5a3578e66fd4e2e8f446f39bd2606d0b08e Mon Sep 17 00:00:00 2001 From: YK <81808708+yk-eukarya@users.noreply.github.com> Date: Mon, 19 Jun 2023 12:53:40 +0300 Subject: [PATCH 2/6] imp --- .github/workflows/deploiy_aws.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploiy_aws.yml b/.github/workflows/deploiy_aws.yml index 1e41e29f9d..3c318ef952 100644 --- a/.github/workflows/deploiy_aws.yml +++ b/.github/workflows/deploiy_aws.yml @@ -69,4 +69,4 @@ jobs: run: | docker pull $IMAGE docker tag $IMAGE ${{ steps.login-ecr.outputs.registry }}/$IMAGE_AWS - docker push ${{ steps.login-ecr.outputs.registry }}/$IMAGE_AWS + docker push ${{ steps.login-ecr.outputs.registry }}/$IMAGE_AWS \ No newline at end of file From 5c1050c421462feb1a4744767cecefd1fd41bf34 Mon Sep 17 00:00:00 2001 From: YK <81808708+yk-eukarya@users.noreply.github.com> Date: Mon, 19 Jun 2023 13:06:33 +0300 Subject: [PATCH 3/6] imp --- .github/workflows/deploiy_aws.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploiy_aws.yml b/.github/workflows/deploiy_aws.yml index 3c318ef952..c0e70801ac 100644 --- a/.github/workflows/deploiy_aws.yml +++ b/.github/workflows/deploiy_aws.yml @@ -1,5 +1,6 @@ name: deploy-aws on: + push: # to register the workflow workflow_dispatch: inputs: keyId: From a7fd7a3e248853e313ea4d6addd2a51e093ab798 Mon Sep 17 00:00:00 2001 From: YK <81808708+yk-eukarya@users.noreply.github.com> Date: Mon, 19 Jun 2023 13:07:07 +0300 Subject: [PATCH 4/6] imp --- .github/workflows/deploiy_aws.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploiy_aws.yml b/.github/workflows/deploiy_aws.yml index c0e70801ac..3c318ef952 100644 --- a/.github/workflows/deploiy_aws.yml +++ b/.github/workflows/deploiy_aws.yml @@ -1,6 +1,5 @@ name: deploy-aws on: - push: # to register the workflow workflow_dispatch: inputs: keyId: From 68ef7ba7bd61a64c336a7a0650de16af3562ef8b Mon Sep 17 00:00:00 2001 From: YK <81808708+yk-eukarya@users.noreply.github.com> Date: Mon, 19 Jun 2023 13:13:26 +0300 Subject: [PATCH 5/6] fix --- .github/workflows/deploiy_aws.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploiy_aws.yml b/.github/workflows/deploiy_aws.yml index 3c318ef952..d845e3f275 100644 --- a/.github/workflows/deploiy_aws.yml +++ b/.github/workflows/deploiy_aws.yml @@ -5,11 +5,11 @@ on: keyId: description: 'You can override the AWS access key id, or keep it empty to use the default from the secrets' required: false - default: ${{ secrets.AWS_ACCESS_KEY_ID }} + default: secretAccessKey: description: 'You can override the AWS secret access key, or keep it empty to use the default from the secrets' required: false - default: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + default: env: # server IMAGE: reearth/reearth:nightly @@ -57,8 +57,8 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v2 with: - aws-access-key-id: ${{ github.events.inputs.keyId }} - aws-secret-access-key: ${{ github.events.inputs.secretAccessKey }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID || github.events.inputs.keyId }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY || github.events.inputs.secretAccessKey }} aws-region: us-west-2 - name: Log in to AWS ECR From 5d1c225b92243dfe7530e8b7a4b4404f1c0fe87d Mon Sep 17 00:00:00 2001 From: YK <81808708+yk-eukarya@users.noreply.github.com> Date: Wed, 21 Jun 2023 22:25:13 +0300 Subject: [PATCH 6/6] remove unused code --- .github/workflows/deploiy_aws.yml | 36 +------------------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/.github/workflows/deploiy_aws.yml b/.github/workflows/deploiy_aws.yml index d845e3f275..bbf9930836 100644 --- a/.github/workflows/deploiy_aws.yml +++ b/.github/workflows/deploiy_aws.yml @@ -16,40 +16,6 @@ env: IMAGE_AWS: reearth-test-server:latest jobs: -# deploy_web: -# name: Deploy web to AWS -# runs-on: ubuntu-latest -# defaults: -# run: -# working-directory: web -# steps: -# - name: Set up Node.js -# uses: actions/setup-node@v3 -# with: -# node-version: lts/* -# - name: Configure AWS credentials -# uses: aws-actions/configure-aws-credentials@v1 -# with: -# aws-access-key-id: ${{ github.events.inputs.keyId }} -# aws-secret-access-key: ${{ github.events.inputs.secretAccessKey }} -# aws-region: us-east-1 -# - name: Install Amplify CLI -# run: yarn global add @aws-amplify/cli -# - name: Download artifact -# uses: dawidd6/action-download-artifact@v2 -# with: -# github_token: ${{ secrets.GITHUB_TOKEN }} -# workflow: ci_web.yml -# workflow_conclusion: success -# branch: main -# name: reearth-cms-web -# - name: Extract artifact -# run: tar -xf reearth-cms-web.tar.gz -# - name: Initialize Amplify -# run: amplify init --appId ${{ secrets.AWS_AMPLIFY_APP_ID }} --envName test --yes -# - name: Build and Deploy to Amplify -# run: amplify publish --appId ${{ secrets.AWS_AMPLIFY_APP_ID }} --envName test --yes - deploy_server: name: Deploy server to AWS runs-on: ubuntu-latest @@ -69,4 +35,4 @@ jobs: run: | docker pull $IMAGE docker tag $IMAGE ${{ steps.login-ecr.outputs.registry }}/$IMAGE_AWS - docker push ${{ steps.login-ecr.outputs.registry }}/$IMAGE_AWS \ No newline at end of file + docker push ${{ steps.login-ecr.outputs.registry }}/$IMAGE_AWS