diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..8ada168 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,28 @@ +name: Build & Deploy + +on: + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/${{ secrets.ROLE_NAME }} + aws-region: ${{ secrets.REGION}} + - name: Build + run: | + npm install + npm run build + - name: Remove Old Version + run: | + aws s3 rm s3://${{ secrets.BUCKET_NAME }}/${{ secrets.DIRECTORY }} --recursive + - name: Deploy to S3 + run: | + aws s3 sync ./dist s3://${{ secrets.BUCKET_NAME }}/${{ secrets.DIRECTORY }}