chore: Update deploy.yml to use yarn berry cahce #38
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Deploy | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout source code. | |
uses: actions/checkout@v4 | |
- name: Set Yarn Version | |
id: set-version | |
run: | | |
yarn set version berry | |
echo "YARN_VERSION=$(yarn -v)" >> $GITHUB_OUTPUT | |
- name: Yarn Cache - PnP | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.yarn/cache | |
.pnp.* | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ steps.set-version.outputs.YARN_VERSION }} | |
restore-keys: | | |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}- | |
- name: Install Dependencies | |
run: | | |
yarn add swc | |
yarn install --immutable --immutable-cache | |
- name: Build | |
run: yarn build | |
- name: zip create | |
run: zip -qq -r ./test-build.zip . | |
shell: bash | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Upload to S3 | |
run: | | |
aws s3 cp --region ap-northeast-2 ./test-build.zip s3://next-blog-s3-bucket/test-build.zip | |
- name: Deploy | |
run: aws deploy create-deployment | |
--application-name next-blog-codeDeploy | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name next-blog-group | |
--s3-location bucket=next-blog-s3-bucket,key=test-build.zip,bundleType=zip |