From bc70ecea312ad148144602e04b23eb75710d3064 Mon Sep 17 00:00:00 2001 From: kcwww Date: Fri, 19 Apr 2024 13:09:57 +0900 Subject: [PATCH] chore: add temporary deploy cicd --- .github/workflows/tempFrontDeploy.yml | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/tempFrontDeploy.yml diff --git a/.github/workflows/tempFrontDeploy.yml b/.github/workflows/tempFrontDeploy.yml new file mode 100644 index 0000000..227a9d0 --- /dev/null +++ b/.github/workflows/tempFrontDeploy.yml @@ -0,0 +1,54 @@ +# This is a basic workflow to help you get started with Actions + +name: FrontEnd deploy + +# Controls when the workflow will run +on: + push: + branches: ["FE/noBE"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: "18" + + - name: Check Node v + run: node -v + + - name: Install dependencies + working-directory: ./front + run: npm install + + - name: Generate build + working-directory: ./front + run: npm run build + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ap-northeast-2 + + - name: Upload to S3 + run: | + aws s3 sync \ + ./front/dist s3://snowball-ssock --delete + + - name: CloudFront Invalidation + env: + CLOUD_FRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID}} + run: | + aws cloudfront create-invalidation \ + --distribution-id $CLOUD_FRONT_ID --paths '/*'